MCPcopy Create free account
hub / github.com/modelscope/modelscope / get_default_automodel

Function get_default_automodel

modelscope/utils/automodel_utils.py:65–76  ·  view source on GitHub ↗
(config)

Source from the content-addressed store, hash-verified

63
64
65def get_default_automodel(config) -> Optional[type]:
66 import modelscope.utils.hf_util as hf_util
67 if not hasattr(config, 'auto_map'):
68 return None
69 auto_map = config.auto_map
70 automodel_list = [k for k in auto_map.keys() if k.startswith('AutoModel')]
71 if len(automodel_list) == 1:
72 return getattr(hf_util, automodel_list[0])
73 if len(automodel_list) > 1 and len(
74 set([auto_map[k] for k in automodel_list])) == 1:
75 return getattr(hf_util, automodel_list[0])
76 return None
77
78
79def get_hf_automodel_class(model_dir: str,

Callers 1

get_hf_automodel_classFunction · 0.85

Calls 1

keysMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…