Put file to the cache Args: cache_root(`str`): The modelscope local cache root(default: ~/.cache/modelscope/hub) owner(`str`): The model owner. name('str'): The name of the model Returns: Raises: None m
(self, cache_root, owner=None, name=None)
| 165 | """ |
| 166 | |
| 167 | def __init__(self, cache_root, owner=None, name=None): |
| 168 | """Put file to the cache |
| 169 | Args: |
| 170 | cache_root(`str`): The modelscope local cache root(default: ~/.cache/modelscope/hub) |
| 171 | owner(`str`): The model owner. |
| 172 | name('str'): The name of the model |
| 173 | Returns: |
| 174 | Raises: |
| 175 | None |
| 176 | <Tip> |
| 177 | model_id = {owner}/{name} |
| 178 | </Tip> |
| 179 | """ |
| 180 | if owner is None or name is None: |
| 181 | # get model meta from |
| 182 | super().__init__(os.path.join(cache_root)) |
| 183 | self.load_model_meta() |
| 184 | else: |
| 185 | super().__init__(os.path.join(cache_root, owner, name)) |
| 186 | self.model_meta = { |
| 187 | FileSystemCache.MODEL_META_MODEL_ID: '%s/%s' % (owner, name) |
| 188 | } |
| 189 | self.save_model_meta() |
| 190 | self.cached_model_revision = self.load_model_version() |
| 191 | |
| 192 | def load_model_meta(self): |
| 193 | meta_file_path = os.path.join(self.cache_root_location, |
nothing calls this directly
no test coverage detected