YOLO-World
YOLO-World copied to clipboard
Possible to run Gradio demo in Windows?
I cloned the repo, downloaded the weights file
yolow-v8_l_clipv2_frozen_t2iv2_bn_o365_goldg_pretrain.pth
But when I attempt to run the demo, I get this:
D:\Python Stuff\yolo-world>python demo.py configs/pretrain/yolo_world_l_dual_vlpan_vlpan_l2norm_2e-3_100e_4x8gpus_obj365v1_goldg_train_lvis_minival.py yolow-v8_l_clipv2_frozen_t2iv2_bn_o365_goldg_pretrain.pth
2024-02-15 18:53:13.530020: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2024-02-15 18:53:13.530312: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ D:\Python Stuff\yolo-world\demo.py:145 in <module> │
│ │
│ 142 │ args = parse_args() │
│ 143 │ │
│ 144 │ # load config │
│ ❱ 145 │ cfg = Config.fromfile(args.config) │
│ 146 │ if args.cfg_options is not None: │
│ 147 │ │ cfg.merge_from_dict(args.cfg_options) │
│ 148 │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\mmengine\config\config.py │
│ :459 in fromfile │
│ │
│ 456 │ │ filename = str(filename) if isinstance(filename, Path) else filename │
│ 457 │ │ if lazy_import is False or \ │
│ 458 │ │ lazy_import is None and not Config._is_lazy_import(filename): │
│ ❱ 459 │ │ │ cfg_dict, cfg_text, env_variables = Config._file2dict( │
│ 460 │ │ │ │ filename, use_predefined_variables, use_environment_variables, │
│ 461 │ │ │ │ lazy_import) │
│ 462 │ │ │ if import_custom_modules and cfg_dict.get('custom_imports', None): │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\mmengine\config\config.py │
│ :943 in _file2dict │
│ │
│ 940 │ │ except Exception as e: │
│ 941 │ │ │ if osp.exists(temp_config_dir): │
│ 942 │ │ │ │ shutil.rmtree(temp_config_dir) │
│ ❱ 943 │ │ │ raise e │
│ 944 │ │ │
│ 945 │ │ # check deprecation information │
│ 946 │ │ if DEPRECATION_KEY in cfg_dict: │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\mmengine\config\config.py │
│ :885 in _file2dict │
│ │
│ 882 │ │ │ │ │ │ temp_config_file.name): │
│ 883 │ │ │ │ │ base_cfg_path, scope = Config._get_cfg_path( │
│ 884 │ │ │ │ │ │ base_cfg_path, filename) │
│ ❱ 885 │ │ │ │ │ _cfg_dict, _cfg_text, _env_variables = Config._file2dict( │
│ 886 │ │ │ │ │ │ filename=base_cfg_path, │
│ 887 │ │ │ │ │ │ use_predefined_variables=use_predefined_variables, │
│ 888 │ │ │ │ │ │ use_environment_variables=use_environment_variables, │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\mmengine\config\config.py │
│ :841 in _file2dict │
│ │
│ 838 │ │ Returns: │
│ 839 │ │ │ Tuple[dict, str]: Variables dictionary and text of Config. │
│ 840 │ │ """ │
│ ❱ 841 │ │ if lazy_import is None and Config._is_lazy_import(filename): │
│ 842 │ │ │ raise RuntimeError( │
│ 843 │ │ │ │ 'The configuration file type in the inheritance chain ' │
│ 844 │ │ │ │ 'must match the current configuration file type, either ' │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\mmengine\config\config.py │
│ :1657 in _is_lazy_import │
│ │
│ 1654 │ def _is_lazy_import(filename: str) -> bool: │
│ 1655 │ │ if not filename.endswith('.py'): │
│ 1656 │ │ │ return False │
│ ❱ 1657 │ │ with open(filename, encoding='utf-8') as f: │
│ 1658 │ │ │ codes_str = f.read() │
│ 1659 │ │ │ parsed_codes = ast.parse(codes_str) │
│ 1660 │ │ for node in ast.walk(parsed_codes): │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
FileNotFoundError: [Errno 2] No such file or directory: 'D:\\Python
Stuff\\yolo-world\\configs\\pretrain\\../../third_party/mmyolo/configs/yolov8/yolov8_l_syncbn_fast_8xb16-500e_coco.py'
I checked Huggingface repo from the link: https://huggingface.co/spaces/stevengrove/YOLO-World/tree/main
and found that there are much more files in mmyolo
folder to download. Could you please clarify what I should download to make it work?
Thanks!
I found out I had to git clone mmyolo submodule and faced another issue:
weight_decay = 0.025
widen_factor = 1.0
work_dir = './work_dirs\\yolo_world_l_dual_vlpan_vlpan_l2norm_2e-3_100e_4x8gpus_obj365v1_goldg_train_lvis_minival'
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\utils\_er │
│ rors.py:261 in hf_raise_for_status │
│ │
│ 258 │ </Tip> │
│ 259 │ """ │
│ 260 │ try: │
│ ❱ 261 │ │ response.raise_for_status() │
│ 262 │ except HTTPError as e: │
│ 263 │ │ error_code = response.headers.get("X-Error-Code") │
│ 264 │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\models.py:1021 │
│ in raise_for_status │
│ │
│ 1018 │ │ │ ) │
│ 1019 │ │ │
│ 1020 │ │ if http_error_msg: │
│ ❱ 1021 │ │ │ raise HTTPError(http_error_msg, response=self) │
│ 1022 │ │
│ 1023 │ def close(self): │
│ 1024 │ │ """Releases the connection back to the pool. Once this method has been │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/pretrained_models/clip-vit-base-patch32-projection/resolve/main/tokenizer_config.json
The above exception was the direct cause of the following exception:
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\utils\hub.py │
│ :409 in cached_file │
│ │
│ 406 │ user_agent = http_user_agent(user_agent) │
│ 407 │ try: │
│ 408 │ │ # Load from URL or cache if already cached │
│ ❱ 409 │ │ resolved_file = hf_hub_download( │
│ 410 │ │ │ path_or_repo_id, │
│ 411 │ │ │ filename, │
│ 412 │ │ │ subfolder=None if len(subfolder) == 0 else subfolder, │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\utils\_va │
│ lidators.py:118 in _inner_fn │
│ │
│ 115 │ │ if check_use_auth_token: │
│ 116 │ │ │ kwargs = smoothly_deprecate_use_auth_token(fn_name=fn.__name__, has_token=ha │
│ 117 │ │ │
│ ❱ 118 │ │ return fn(*args, **kwargs) │
│ 119 │ │
│ 120 │ return _inner_fn # type: ignore │
│ 121 │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\file_down │
│ load.py:1346 in hf_hub_download │
│ │
│ 1343 │ │ │ ) │
│ 1344 │ │ elif isinstance(head_call_error, RepositoryNotFoundError) or isinstance(head_cal │
│ 1345 │ │ │ # Repo not found => let's raise the actual error │
│ ❱ 1346 │ │ │ raise head_call_error │
│ 1347 │ │ else: │
│ 1348 │ │ │ # Otherwise: most likely a connection issue or Hub downtime => let's warn th │
│ 1349 │ │ │ raise LocalEntryNotFoundError( │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\file_down │
│ load.py:1232 in hf_hub_download │
│ │
│ 1229 │ if not local_files_only: │
│ 1230 │ │ try: │
│ 1231 │ │ │ try: │
│ ❱ 1232 │ │ │ │ metadata = get_hf_file_metadata( │
│ 1233 │ │ │ │ │ url=url, │
│ 1234 │ │ │ │ │ token=token, │
│ 1235 │ │ │ │ │ proxies=proxies, │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\utils\_va │
│ lidators.py:118 in _inner_fn │
│ │
│ 115 │ │ if check_use_auth_token: │
│ 116 │ │ │ kwargs = smoothly_deprecate_use_auth_token(fn_name=fn.__name__, has_token=ha │
│ 117 │ │ │
│ ❱ 118 │ │ return fn(*args, **kwargs) │
│ 119 │ │
│ 120 │ return _inner_fn # type: ignore │
│ 121 │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\file_down │
│ load.py:1608 in get_hf_file_metadata │
│ │
│ 1605 │ │ proxies=proxies, │
│ 1606 │ │ timeout=timeout, │
│ 1607 │ ) │
│ ❱ 1608 │ hf_raise_for_status(r) │
│ 1609 │ │
│ 1610 │ # Return │
│ 1611 │ return HfFileMetadata( │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\utils\_er │
│ rors.py:293 in hf_raise_for_status │
│ │
│ 290 │ │ │ │ " `repo_type`.\nIf you are trying to access a private or gated repo," │
│ 291 │ │ │ │ " make sure you are authenticated." │
│ 292 │ │ │ ) │
│ ❱ 293 │ │ │ raise RepositoryNotFoundError(message, response) from e │
│ 294 │ │ │
│ 295 │ │ elif response.status_code == 400: │
│ 296 │ │ │ message = ( │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
RepositoryNotFoundError: 404 Client Error. (Request ID: Root=1-65ce74c6-3fc2f73170e33a2629da83e4;ca7475ed-3a1c-4013-ab43-1ed1adda7ee2)
Repository Not Found for url: https://huggingface.co/pretrained_models/clip-vit-base-patch32-projection/resolve/main/tokenizer_config.json.
Please make sure you specified the correct `repo_id` and `repo_type`.
If you are trying to access a private or gated repo, make sure you are authenticated.
During handling of the above exception, another exception occurred:
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ D:\Python Stuff\yolo-world\demo.py:158 in <module> │
│ │
│ 155 │ cfg.load_from = args.checkpoint │
│ 156 │ │
│ 157 │ if 'runner_type' not in cfg: │
│ ❱ 158 │ │ runner = Runner.from_cfg(cfg) │
│ 159 │ else: │
│ 160 │ │ runner = RUNNERS.build(cfg) │
│ 161 │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\mmengine\runner\runner.py │
│ :462 in from_cfg │
│ │
│ 459 │ │ │ Runner: A runner build from ``cfg``. │
│ 460 │ │ """ │
│ 461 │ │ cfg = copy.deepcopy(cfg) │
│ ❱ 462 │ │ runner = cls( │
│ 463 │ │ │ model=cfg['model'], │
│ 464 │ │ │ work_dir=cfg['work_dir'], │
│ 465 │ │ │ train_dataloader=cfg.get('train_dataloader'), │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\mmengine\runner\runner.py │
│ :429 in __init__ │
│ │
│ 426 │ │ if isinstance(model, dict) and data_preprocessor is not None: │
│ 427 │ │ │ # Merge the data_preprocessor to model config. │
│ 428 │ │ │ model.setdefault('data_preprocessor', data_preprocessor) │
│ ❱ 429 │ │ self.model = self.build_model(model) │
│ 430 │ │ # wrap model │
│ 431 │ │ self.model = self.wrap_model( │
│ 432 │ │ │ self.cfg.get('model_wrapper_cfg'), self.model) │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\mmengine\runner\runner.py │
│ :836 in build_model │
│ │
│ 833 │ │ if isinstance(model, nn.Module): │
│ 834 │ │ │ return model │
│ 835 │ │ elif isinstance(model, dict): │
│ ❱ 836 │ │ │ model = MODELS.build(model) │
│ 837 │ │ │ return model # type: ignore │
│ 838 │ │ else: │
│ 839 │ │ │ raise TypeError('model should be a nn.Module object or dict, ' │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\mmengine\registry\registr │
│ y.py:570 in build │
│ │
│ 567 │ │ │ >>> cfg = dict(type='ResNet', depth=50) │
│ 568 │ │ │ >>> model = MODELS.build(cfg) │
│ 569 │ │ """ │
│ ❱ 570 │ │ return self.build_func(cfg, *args, **kwargs, registry=self) │
│ 571 │ │
│ 572 │ def _add_child(self, registry: 'Registry') -> None: │
│ 573 │ │ """Add a child for a registry. │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\mmengine\registry\build_f │
│ unctions.py:232 in build_model_from_cfg │
│ │
│ 229 │ │ ] │
│ 230 │ │ return Sequential(*modules) │
│ 231 │ else: │
│ ❱ 232 │ │ return build_from_cfg(cfg, registry, default_args) │
│ 233 │
│ 234 │
│ 235 def build_scheduler_from_cfg( │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\mmengine\registry\build_f │
│ unctions.py:121 in build_from_cfg │
│ │
│ 118 │ │ │ │ issubclass(obj_cls, ManagerMixin): # type: ignore │
│ 119 │ │ │ obj = obj_cls.get_instance(**args) # type: ignore │
│ 120 │ │ else: │
│ ❱ 121 │ │ │ obj = obj_cls(**args) # type: ignore │
│ 122 │ │ │
│ 123 │ │ if (inspect.isclass(obj_cls) or inspect.isfunction(obj_cls) │
│ 124 │ │ │ │ or inspect.ismethod(obj_cls)): │
│ │
│ D:\Python Stuff\yolo-world\yolo_world\models\detectors\yolo_world.py:21 in __init__ │
│ │
│ 18 │ │ self.mm_neck = mm_neck │
│ 19 │ │ self.num_train_classes = num_train_classes │
│ 20 │ │ self.num_test_classes = num_test_classes │
│ ❱ 21 │ │ super().__init__(*args, **kwargs) │
│ 22 │ │
│ 23 │ def loss(self, batch_inputs: Tensor, │
│ 24 │ │ │ batch_data_samples: SampleList) -> Union[dict, list]: │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\mmyolo\models\detectors\y │
│ olo_detector.py:41 in __init__ │
│ │
│ 38 │ │ │ │ data_preprocessor: OptConfigType = None, │
│ 39 │ │ │ │ init_cfg: OptMultiConfig = None, │
│ 40 │ │ │ │ use_syncbn: bool = True): │
│ ❱ 41 │ │ super().__init__( │
│ 42 │ │ │ backbone=backbone, │
│ 43 │ │ │ neck=neck, │
│ 44 │ │ │ bbox_head=bbox_head, │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\mmdet\models\detectors\si │
│ ngle_stage.py:30 in __init__ │
│ │
│ 27 │ │ │ │ init_cfg: OptMultiConfig = None) -> None: │
│ 28 │ │ super().__init__( │
│ 29 │ │ │ data_preprocessor=data_preprocessor, init_cfg=init_cfg) │
│ ❱ 30 │ │ self.backbone = MODELS.build(backbone) │
│ 31 │ │ if neck is not None: │
│ 32 │ │ │ self.neck = MODELS.build(neck) │
│ 33 │ │ bbox_head.update(train_cfg=train_cfg) │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\mmengine\registry\registr │
│ y.py:570 in build │
│ │
│ 567 │ │ │ >>> cfg = dict(type='ResNet', depth=50) │
│ 568 │ │ │ >>> model = MODELS.build(cfg) │
│ 569 │ │ """ │
│ ❱ 570 │ │ return self.build_func(cfg, *args, **kwargs, registry=self) │
│ 571 │ │
│ 572 │ def _add_child(self, registry: 'Registry') -> None: │
│ 573 │ │ """Add a child for a registry. │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\mmengine\registry\build_f │
│ unctions.py:232 in build_model_from_cfg │
│ │
│ 229 │ │ ] │
│ 230 │ │ return Sequential(*modules) │
│ 231 │ else: │
│ ❱ 232 │ │ return build_from_cfg(cfg, registry, default_args) │
│ 233 │
│ 234 │
│ 235 def build_scheduler_from_cfg( │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\mmengine\registry\build_f │
│ unctions.py:121 in build_from_cfg │
│ │
│ 118 │ │ │ │ issubclass(obj_cls, ManagerMixin): # type: ignore │
│ 119 │ │ │ obj = obj_cls.get_instance(**args) # type: ignore │
│ 120 │ │ else: │
│ ❱ 121 │ │ │ obj = obj_cls(**args) # type: ignore │
│ 122 │ │ │
│ 123 │ │ if (inspect.isclass(obj_cls) or inspect.isfunction(obj_cls) │
│ 124 │ │ │ │ or inspect.ismethod(obj_cls)): │
│ │
│ D:\Python Stuff\yolo-world\yolo_world\models\backbones\mm_backbone.py:208 in __init__ │
│ │
│ 205 │ │ super().__init__(init_cfg) │
│ 206 │ │ │
│ 207 │ │ self.image_model = MODELS.build(image_model) │
│ ❱ 208 │ │ self.text_model = MODELS.build(text_model) │
│ 209 │ │
│ 210 │ def forward(self, image: Tensor, │
│ 211 │ │ │ │ text: List[List[str]]) -> Tuple[Tuple[Tensor], Tensor]: │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\mmengine\registry\registr │
│ y.py:570 in build │
│ │
│ 567 │ │ │ >>> cfg = dict(type='ResNet', depth=50) │
│ 568 │ │ │ >>> model = MODELS.build(cfg) │
│ 569 │ │ """ │
│ ❱ 570 │ │ return self.build_func(cfg, *args, **kwargs, registry=self) │
│ 571 │ │
│ 572 │ def _add_child(self, registry: 'Registry') -> None: │
│ 573 │ │ """Add a child for a registry. │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\mmengine\registry\build_f │
│ unctions.py:232 in build_model_from_cfg │
│ │
│ 229 │ │ ] │
│ 230 │ │ return Sequential(*modules) │
│ 231 │ else: │
│ ❱ 232 │ │ return build_from_cfg(cfg, registry, default_args) │
│ 233 │
│ 234 │
│ 235 def build_scheduler_from_cfg( │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\mmengine\registry\build_f │
│ unctions.py:121 in build_from_cfg │
│ │
│ 118 │ │ │ │ issubclass(obj_cls, ManagerMixin): # type: ignore │
│ 119 │ │ │ obj = obj_cls.get_instance(**args) # type: ignore │
│ 120 │ │ else: │
│ ❱ 121 │ │ │ obj = obj_cls(**args) # type: ignore │
│ 122 │ │ │
│ 123 │ │ if (inspect.isclass(obj_cls) or inspect.isfunction(obj_cls) │
│ 124 │ │ │ │ or inspect.ismethod(obj_cls)): │
│ │
│ D:\Python Stuff\yolo-world\yolo_world\models\backbones\mm_backbone.py:74 in __init__ │
│ │
│ 71 │ │ │
│ 72 │ │ self.frozen_modules = frozen_modules │
│ 73 │ │ self.training_use_cache = training_use_cache │
│ ❱ 74 │ │ self.tokenizer = AutoTokenizer.from_pretrained(model_name) │
│ 75 │ │ clip_config = CLIPTextConfig.from_pretrained(model_name, │
│ 76 │ │ │ │ │ │ │ │ │ │ │ │ │ attention_dropout=dropout) │
│ 77 │ │ self.model = CLIPTP.from_pretrained(model_name, │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\models\auto\ │
│ tokenization_auto.py:582 in from_pretrained │
│ │
│ 579 │ │ │ return tokenizer_class.from_pretrained(pretrained_model_name_or_path, *input │
│ 580 │ │ │
│ 581 │ │ # Next, let's try to use the tokenizer_config file to get the tokenizer class. │
│ ❱ 582 │ │ tokenizer_config = get_tokenizer_config(pretrained_model_name_or_path, **kwargs) │
│ 583 │ │ if "_commit_hash" in tokenizer_config: │
│ 584 │ │ │ kwargs["_commit_hash"] = tokenizer_config["_commit_hash"] │
│ 585 │ │ config_tokenizer_class = tokenizer_config.get("tokenizer_class") │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\models\auto\ │
│ tokenization_auto.py:433 in get_tokenizer_config │
│ │
│ 430 │ tokenizer_config = get_tokenizer_config("tokenizer-test") │
│ 431 │ ```""" │
│ 432 │ commit_hash = kwargs.get("_commit_hash", None) │
│ ❱ 433 │ resolved_config_file = cached_file( │
│ 434 │ │ pretrained_model_name_or_path, │
│ 435 │ │ TOKENIZER_CONFIG_FILE, │
│ 436 │ │ cache_dir=cache_dir, │
│ │
│ C:\Users\Max\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\utils\hub.py │
│ :424 in cached_file │
│ │
│ 421 │ │ ) │
│ 422 │ │
│ 423 │ except RepositoryNotFoundError: │
│ ❱ 424 │ │ raise EnvironmentError( │
│ 425 │ │ │ f"{path_or_repo_id} is not a local folder and is not a valid model identifie │
│ 426 │ │ │ "listed on 'https://huggingface.co/models'\nIf this is a private repository, │
│ 427 │ │ │ "pass a token having permission to this repo with `use_auth_token` or log in │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
OSError: pretrained_models/clip-vit-base-patch32-projection is not a local folder and is not a valid model identifier listed on 'https://huggingface.co/models'
If this is a private repository, make sure to pass a token having permission to this repo with `use_auth_token` or log in with `huggingface-cli login` and pass
`use_auth_token=True`.