jhj0517 / sam2-playground

Playground Web UI using segment-anything-2 models from the Meta.
Apache License 2.0
19 stars 1 forks source link

Doesn't work on windows #11

Open Mozoloa opened 3 days ago

Mozoloa commented 3 days ago

Installed on w11 following the instructions, everything is updated yet, just launching then selecting any model downloads the model but gives this in the console instantly:

G:\AI\Video\sam2-playground-portable-windows>set ARGS=
device "cuda" is detected
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Applying configs to sam2.1_hiera_large model..
Error while loading SAM2 model for video predictor
Traceback (most recent call last):
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\modules\sam_inference.py", line 78, in load_model
    self.video_predictor = build_sam2_video_predictor(
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\sam2\build_sam.py", line 71, in build_sam2_video_predictor
    cfg = compose(config_name=config_file, overrides=hydra_overrides)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\compose.py", line 38, in compose
    cfg = gh.hydra.compose_config(
          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\hydra.py", line 594, in compose_config
    cfg = self.config_loader.load_configuration(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\config_loader_impl.py", line 142, in load_configuration
    return self._load_configuration_impl(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\config_loader_impl.py", line 253, in _load_configuration_impl
    defaults_list = create_defaults_list(
                    ^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\defaults_list.py", line 745, in create_defaults_list
    defaults, tree = _create_defaults_list(
                     ^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\defaults_list.py", line 715, in _create_defaults_list
    defaults_tree = _create_defaults_tree(
                    ^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\defaults_list.py", line 356, in _create_defaults_tree
    ret = _create_defaults_tree_impl(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\defaults_list.py", line 457, in _create_defaults_tree_impl
    return _expand_virtual_root(repo, root, overrides, skip_missing)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\defaults_list.py", line 280, in _expand_virtual_root
    subtree = _create_defaults_tree_impl(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\defaults_list.py", line 464, in _create_defaults_tree_impl
    config_not_found_error(repo=repo, tree=root)
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\defaults_list.py", line 799, in config_not_found_error
    raise MissingConfigException(
hydra.errors.MissingConfigException: Cannot find primary config 'configs\sam2.1\sam2.1_hiera_l.yaml'. Check that it's in your config search path.

Config search path:
        provider=hydra, path=pkg://hydra.conf
        provider=main, path=pkg://sam2_configs
        provider=schema, path=structured://
Error while loading SAM2 model
Traceback (most recent call last):
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\modules\sam_inference.py", line 89, in load_model
    self.model = build_sam2(
                 ^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\sam2\build_sam.py", line 34, in build_sam2
    cfg = compose(config_name=config_file, overrides=hydra_overrides_extra)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\compose.py", line 38, in compose
    cfg = gh.hydra.compose_config(
          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\hydra.py", line 594, in compose_config
    cfg = self.config_loader.load_configuration(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\config_loader_impl.py", line 142, in load_configuration
    return self._load_configuration_impl(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\config_loader_impl.py", line 253, in _load_configuration_impl
    defaults_list = create_defaults_list(
                    ^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\defaults_list.py", line 745, in create_defaults_list
    defaults, tree = _create_defaults_list(
                     ^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\defaults_list.py", line 715, in _create_defaults_list
    defaults_tree = _create_defaults_tree(
                    ^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\defaults_list.py", line 356, in _create_defaults_tree
    ret = _create_defaults_tree_impl(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\defaults_list.py", line 457, in _create_defaults_tree_impl
    return _expand_virtual_root(repo, root, overrides, skip_missing)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\defaults_list.py", line 280, in _expand_virtual_root
    subtree = _create_defaults_tree_impl(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\defaults_list.py", line 464, in _create_defaults_tree_impl
    config_not_found_error(repo=repo, tree=root)
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\defaults_list.py", line 799, in config_not_found_error
    raise MissingConfigException(
hydra.errors.MissingConfigException: Cannot find primary config 'configs\sam2.1\sam2.1_hiera_l.yaml'. Check that it's in your config search path.

Config search path:
        provider=hydra, path=pkg://hydra.conf
        provider=main, path=pkg://sam2_configs
        provider=schema, path=structured://
Traceback (most recent call last):
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\modules\sam_inference.py", line 89, in load_model
    self.model = build_sam2(
                 ^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\sam2\build_sam.py", line 34, in build_sam2
    cfg = compose(config_name=config_file, overrides=hydra_overrides_extra)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\compose.py", line 38, in compose
    cfg = gh.hydra.compose_config(
          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\hydra.py", line 594, in compose_config
    cfg = self.config_loader.load_configuration(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\config_loader_impl.py", line 142, in load_configuration
    return self._load_configuration_impl(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\config_loader_impl.py", line 253, in _load_configuration_impl
    defaults_list = create_defaults_list(
                    ^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\defaults_list.py", line 745, in create_defaults_list
    defaults, tree = _create_defaults_list(
                     ^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\defaults_list.py", line 715, in _create_defaults_list
    defaults_tree = _create_defaults_tree(
                    ^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\defaults_list.py", line 356, in _create_defaults_tree
    ret = _create_defaults_tree_impl(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\defaults_list.py", line 457, in _create_defaults_tree_impl
    return _expand_virtual_root(repo, root, overrides, skip_missing)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\defaults_list.py", line 280, in _expand_virtual_root
    subtree = _create_defaults_tree_impl(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\defaults_list.py", line 464, in _create_defaults_tree_impl
    config_not_found_error(repo=repo, tree=root)
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\defaults_list.py", line 799, in config_not_found_error
    raise MissingConfigException(
hydra.errors.MissingConfigException: Cannot find primary config 'configs\sam2.1\sam2.1_hiera_l.yaml'. Check that it's in your config search path.

Config search path:
        provider=hydra, path=pkg://hydra.conf
        provider=main, path=pkg://sam2_configs
        provider=schema, path=structured://

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\gradio\queueing.py", line 536, in process_events
    response = await route_utils.call_process_api(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\gradio\route_utils.py", line 322, in call_process_api
    output = await app.get_blocks().process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\gradio\blocks.py", line 1935, in process_api
    result = await self.call_function(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\gradio\blocks.py", line 1520, in call_function
    prediction = await anyio.to_thread.run_sync(  # type: ignore
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\anyio\to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\anyio\_backends\_asyncio.py", line 2405, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\anyio\_backends\_asyncio.py", line 914, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\gradio\utils.py", line 826, in wrapper
    response = f(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\app.py  ", line 84, in on_video_model_change
    self.sam_inf.init_video_inference_state(vid_input=vid_input, model_type=model_type)
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\modules\sam_inference.py", line 113, in init_video_inference_state
    self.load_model(model_type=model_type, load_video_predictor=True)
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\modules\sam_inference.py", line 96, in load_model
    raise RuntimeError(f"Failed to load model") from e
RuntimeError: Failed to load model

I've seen some issues about hydra but I don't understand anything nor know what to do, it's very confusing. It looks like this repo is non functional on windows

jhj0517 commented 3 days ago

Hi @Mozoloa . I just tried to reproduce the error but failed, it worked fine on my environment.

I'm just planning to load model using huggingface API.

jhj0517 commented 3 days ago

I tried to fix it in #13, Can you see if it still happens in the latest version?

Mozoloa commented 2 days ago

Ran update.bat, no change in requirements so launched the UI right after and got this (don't think it has changed)

G:\AI\Video\sam2-playground-portable-windows>set ARGS=
device "cuda" is detected
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Applying configs to sam2.1_hiera_large model..
Error while loading SAM2 model for video predictor
Traceback (most recent call last):
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 92, in _call_target
    return _target_(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\sam2\sam2_video_predictor.py", line 33, in __init__
    super().__init__(**kwargs)
TypeError: SAM2Base.__init__() got an unexpected keyword argument 'no_obj_embed_spatial'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\modules\sam_inference.py", line 78, in load_model
    self.video_predictor = build_sam2_video_predictor(
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\sam2\build_sam.py", line 73, in build_sam2_video_predictor
    model = instantiate(cfg.model, _recursive_=True)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 226, in instantiate
    return instantiate_node(
           ^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 347, in instantiate_node
    return _call_target(_target_, partial, args, kwargs, full_key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 97, in _call_target
    raise InstantiationException(msg) from e
hydra.errors.InstantiationException: Error in call to target 'sam2.sam2_video_predictor.SAM2VideoPredictor':
TypeError("SAM2Base.__init__() got an unexpected keyword argument 'no_obj_embed_spatial'")
full_key: model
Error while loading SAM2 model
Traceback (most recent call last):
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 92, in _call_target
    return _target_(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: SAM2Base.__init__() got an unexpected keyword argument 'no_obj_embed_spatial'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\modules\sam_inference.py", line 89, in load_model
    self.model = build_sam2(
                 ^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\sam2\build_sam.py", line 36, in build_sam2
    model = instantiate(cfg.model, _recursive_=True)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 226, in instantiate
    return instantiate_node(
           ^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 347, in instantiate_node
    return _call_target(_target_, partial, args, kwargs, full_key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 97, in _call_target
    raise InstantiationException(msg) from e
hydra.errors.InstantiationException: Error in call to target 'sam2.modeling.sam2_base.SAM2Base':
TypeError("SAM2Base.__init__() got an unexpected keyword argument 'no_obj_embed_spatial'")
full_key: model
Traceback (most recent call last):
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 92, in _call_target
    return _target_(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: SAM2Base.__init__() got an unexpected keyword argument 'no_obj_embed_spatial'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\modules\sam_inference.py", line 89, in load_model
    self.model = build_sam2(
                 ^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\sam2\build_sam.py", line 36, in build_sam2
    model = instantiate(cfg.model, _recursive_=True)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 226, in instantiate
    return instantiate_node(
           ^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 347, in instantiate_node
    return _call_target(_target_, partial, args, kwargs, full_key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\hydra\_internal\instantiate\_instantiate2.py", line 97, in _call_target
    raise InstantiationException(msg) from e
hydra.errors.InstantiationException: Error in call to target 'sam2.modeling.sam2_base.SAM2Base':
TypeError("SAM2Base.__init__() got an unexpected keyword argument 'no_obj_embed_spatial'")
full_key: model

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\gradio\queueing.py", line 536, in process_events
    response = await route_utils.call_process_api(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\gradio\route_utils.py", line 322, in call_process_api
    output = await app.get_blocks().process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\gradio\blocks.py", line 1935, in process_api
    result = await self.call_function(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\gradio\blocks.py", line 1520, in call_function
    prediction = await anyio.to_thread.run_sync(  # type: ignore
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\anyio\to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\anyio\_backends\_asyncio.py", line 2405, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\anyio\_backends\_asyncio.py", line 914, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\venv\Lib\site-packages\gradio\utils.py", line 826, in wrapper
    response = f(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\app.py  ", line 84, in on_video_model_change
    self.sam_inf.init_video_inference_state(vid_input=vid_input, model_type=model_type)
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\modules\sam_inference.py", line 113, in init_video_inference_state
    self.load_model(model_type=model_type, load_video_predictor=True)
  File "G:\AI\Video\sam2-playground-portable-windows\sam2-playground\modules\sam_inference.py", line 96, in load_model
    raise RuntimeError(f"Failed to load model") from e
RuntimeError: Failed to load model
jhj0517 commented 2 days ago

@Mozoloa There was an update in the requirements.txt recently, I fetched upstream in the forked version of the sam2 to follow the recent sam2.1 patch. The patch was done in a forked version of sam-2, so there is no update in the requirements.txt here, but you actually need to update the dependency.

If you re-install the sam-2, then it should work fine without any problem.