cache dir precedence: function parameter > environment > ~/.cache/modelscope/hub/model_id Args: model_id (str, optional): The model id. Returns: str: the model_id dir if model_id not None, otherwise cache root dir.
(model_id: str)
| 94 | |
| 95 | |
| 96 | def get_model_cache_dir(model_id: str) -> str: |
| 97 | """cache dir precedence: |
| 98 | function parameter > environment > ~/.cache/modelscope/hub/model_id |
| 99 | |
| 100 | Args: |
| 101 | model_id (str, optional): The model id. |
| 102 | |
| 103 | Returns: |
| 104 | str: the model_id dir if model_id not None, otherwise cache root dir. |
| 105 | """ |
| 106 | root_path = get_model_cache_root() |
| 107 | return root_path if model_id is None else os.path.join( |
| 108 | root_path, model_id + '/') |
| 109 | |
| 110 | |
| 111 | def read_file(path): |
searching dependent graphs…