MCPcopy Create free account
hub / github.com/modelscope/ms-agent / __init__

Method __init__

ms_agent/utils/push_to_hub.py:338–363  ·  view source on GitHub ↗

Initialize the `PushToModelScope` with authentication. Args: token (str): ModelScope access token with permissions to push to the repository. You can get the token from your ModelScope account settings. Refer to `https://modelscope.cn/my/

(
        self,
        token: str,
    )

Source from the content-addressed store, hash-verified

336 """
337
338 def __init__(
339 self,
340 token: str,
341 ):
342 """
343 Initialize the `PushToModelScope` with authentication.
344
345 Args:
346 token (str): ModelScope access token with permissions to push to the repository.
347 You can get the token from your ModelScope account settings.
348 Refer to `https://modelscope.cn/my/myaccesstoken`
349 """
350
351 if not is_package_installed('modelscope'):
352 raise ImportError(
353 'ModelScope package is not installed. Please install it with `pip install modelscope`.'
354 )
355
356 from modelscope.hub.api import HubApi
357 from modelscope.hub.api import get_endpoint
358
359 self.api = HubApi()
360 self.token = token
361 self.endpoint = get_endpoint()
362
363 super().__init__()
364
365 @staticmethod
366 def _preprocess(folder_path: str,

Callers

nothing calls this directly

Calls 2

is_package_installedFunction · 0.90
__init__Method · 0.45

Tested by

no test coverage detected