From 2b4abc6312cebc4c95eb73e54cc8a35e5d056da3 Mon Sep 17 00:00:00 2001 From: Mohammed Yasin <32206511+Y-T-G@users.noreply.github.com> Date: Thu, 21 Dec 2023 14:59:47 +0800 Subject: [PATCH] Fix "has no attribute startswith" (#2498) The value needs to be converted to string first. --- mmdeploy/utils/config_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmdeploy/utils/config_utils.py b/mmdeploy/utils/config_utils.py index 6af418421a..db39ec22b4 100644 --- a/mmdeploy/utils/config_utils.py +++ b/mmdeploy/utils/config_utils.py @@ -97,7 +97,7 @@ def get_codebase(deploy_cfg: Union[str, mmengine.Config], # using mmrazor codebase if the model is a mmrazor model. model_cfg: dict = model_cfg['model'] if model_cfg.get('_scope_', None) == 'mmrazor'\ - or model_cfg['type'].startswith('mmrazor.'): + or str(model_cfg['type']).startswith('mmrazor.'): return register_codebase('mmrazor') codebase_config = get_codebase_config(deploy_cfg) assert 'type' in codebase_config, 'The codebase config of deploy config'\