MCPcopy
hub / github.com/modelscope/ms-swift / register_model

Function register_model

swift/model/register.py:31–42  ·  view source on GitHub ↗

model_type: The unique ID for the model type. Models with the same model_type share the same architectures, template, get_function, etc.

(model_meta: ModelMeta, *, exist_ok: bool = False)

Source from the content-addressed store, hash-verified

29
30
31def register_model(model_meta: ModelMeta, *, exist_ok: bool = False) -> None:
32 """
33 model_type: The unique ID for the model type. Models with the same model_type share
34 the same architectures, template, get_function, etc.
35 """
36 from .model_arch import get_model_arch
37 model_type = model_meta.model_type
38 if not exist_ok and model_type in MODEL_MAPPING:
39 raise ValueError(f'The `{model_type}` has already been registered in the MODEL_MAPPING.')
40 if model_meta.model_arch:
41 model_meta.model_arch = get_model_arch(model_meta.model_arch)
42 MODEL_MAPPING[model_type] = model_meta
43
44
45def load_by_unsloth(args):

Callers 15

test_custom.pyFile · 0.90
model_hf.pyFile · 0.90
model.pyFile · 0.90
my_register.pyFile · 0.90
llm.pyFile · 0.85
llava.pyFile · 0.85
minimax.pyFile · 0.85
mistral.pyFile · 0.85
gemma.pyFile · 0.85
baidu.pyFile · 0.85
minicpm.pyFile · 0.85
openbuddy.pyFile · 0.85

Calls 1

get_model_archFunction · 0.85

Tested by

no test coverage detected