MCPcopy Index your code
hub / github.com/modelscope/modelscope / __init__

Method __init__

modelscope/utils/plugins.py:1213–1236  ·  view source on GitHub ↗

Args: model_id: id of the model, not dir model_revision: revision of the model, default as master cache_dir: the system modelscope cache dir

(self,
                 model_id,
                 model_revision=DEFAULT_MODEL_REVISION,
                 cache_dir=MODELSCOPE_FILE_DIR)

Source from the content-addressed store, hash-verified

1211 name = 'envs'
1212
1213 def __init__(self,
1214 model_id,
1215 model_revision=DEFAULT_MODEL_REVISION,
1216 cache_dir=MODELSCOPE_FILE_DIR):
1217 """
1218
1219 Args:
1220 model_id: id of the model, not dir
1221 model_revision: revision of the model, default as master
1222 cache_dir: the system modelscope cache dir
1223 """
1224 cache_dir = os.getenv('MODELSCOPE_CACHE', cache_dir)
1225 self.env_dir = os.path.join(cache_dir, EnvsManager.name, model_id)
1226 model_dir = snapshot_download(model_id, revision=model_revision)
1227 from modelscope.utils.hub import read_config
1228 cfg = read_config(model_dir)
1229 self.plugins = cfg.get('plugins', [])
1230 self.allow_remote = cfg.get('allow_remote', False)
1231 import venv
1232 self.env_builder = venv.EnvBuilder(
1233 system_site_packages=True,
1234 clear=False,
1235 symlinks=True,
1236 with_pip=False)
1237
1238 def get_env_dir(self):
1239 return self.env_dir

Callers

nothing calls this directly

Calls 3

snapshot_downloadFunction · 0.90
read_configFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected