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

Function create_model_if_not_exist

modelscope/utils/hub.py:20–37  ·  view source on GitHub ↗
(
        api,
        model_id: str,
        chinese_name: str,
        visibility: Optional[int] = ModelVisibility.PUBLIC,
        license: Optional[str] = Licenses.APACHE_V2)

Source from the content-addressed store, hash-verified

18
19
20def create_model_if_not_exist(
21 api,
22 model_id: str,
23 chinese_name: str,
24 visibility: Optional[int] = ModelVisibility.PUBLIC,
25 license: Optional[str] = Licenses.APACHE_V2):
26 if api.repo_exists(model_id):
27 logger.info(f'model {model_id} already exists, skip creation.')
28 return False
29 else:
30 api.create_model(
31 model_id=model_id,
32 visibility=visibility,
33 license=license,
34 chinese_name=chinese_name,
35 )
36 logger.info(f'model {model_id} successfully created.')
37 return True
38
39
40def read_config(model_id_or_path: str,

Callers 1

Calls 2

infoMethod · 0.80
create_modelMethod · 0.45

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…