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

Function get_model_id_from_cache

modelscope/hub/check_model.py:17–30  ·  view source on GitHub ↗
(model_root_path: str, )

Source from the content-addressed store, hash-verified

15
16
17def get_model_id_from_cache(model_root_path: str, ) -> str:
18 model_cache = None
19 # download with git
20 if os.path.exists(os.path.join(model_root_path, '.git')):
21 git_cmd_wrapper = GitCommandWrapper()
22 git_url = git_cmd_wrapper.get_repo_remote_url(model_root_path)
23 if git_url.endswith('.git'):
24 git_url = git_url[:-4]
25 u_parse = urlparse(git_url)
26 model_id = u_parse.path[1:]
27 else: # snapshot_download
28 model_cache = ModelFileSystemCache(model_root_path)
29 model_id = model_cache.get_model_id()
30 return model_id
31
32
33def check_local_model_is_latest(

Callers 2

Calls 5

get_repo_remote_urlMethod · 0.95
get_model_idMethod · 0.95
GitCommandWrapperClass · 0.90
existsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…