Skip to content

Commit

Permalink
[Fix] Fix hub.get_model failure on some mmcls models (#784)
Browse files Browse the repository at this point in the history
  • Loading branch information
C1rN09 committed Dec 4, 2022
1 parent 7e787d8 commit 5ea21f2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mmengine/hub/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ def get_model(cfg_path: str, pretrained: bool = False, **kwargs):
package = cfg_path.split('::')[0]
with DefaultScope.overwrite_default_scope(package): # type: ignore
cfg = get_config(cfg_path, pretrained)
if 'data_preprocessor' in cfg:
cfg.model.data_preprocessor = cfg.data_preprocessor
models_module = importlib.import_module(f'{package}.utils')
models_module.register_all_modules() # type: ignore
model = MODELS.build(cfg.model, default_args=kwargs)
Expand Down

0 comments on commit 5ea21f2

Please sign in to comment.