88
99import huggingface_hub
1010from huggingface_hub import RepoUrl
11- from huggingface_hub .hf_api import CommitInfo , api , future_compatible
11+ from huggingface_hub .hf_api import api , future_compatible
12+ from modelscope .utils .repo_utils import CommitInfo
1213from requests .exceptions import HTTPError
1314from transformers import trainer
1415from transformers .utils import logging , strtobool
@@ -122,13 +123,8 @@ def download_model(cls,
122123class MSHub (HubOperation ):
123124 ms_token = None
124125
125- @classmethod
126- def create_repo (cls ,
127- repo_id : str ,
128- * ,
129- token : Union [str , bool , None ] = None ,
130- private : bool = False ,
131- ** kwargs ) -> RepoUrl :
126+ @staticmethod
127+ def create_repo (repo_id : str , * , token : Union [str , bool , None ] = None , private : bool = False , ** kwargs ) -> RepoUrl :
132128 """
133129 Create a new repository on the hub.
134130
@@ -141,13 +137,13 @@ def create_repo(cls,
141137 Returns:
142138 RepoUrl: The URL of the created repository.
143139 """
144- hub_model_id = cls .create_model_repo (repo_id , token , private )
140+ hub_model_id = MSHub .create_model_repo (repo_id , token , private )
145141 return RepoUrl (url = hub_model_id , )
146142
147- @classmethod
143+ @staticmethod
148144 @future_compatible
149145 def upload_folder (
150- cls ,
146+ self ,
151147 * ,
152148 repo_id : str ,
153149 folder_path : Union [str , Path ],
@@ -159,8 +155,8 @@ def upload_folder(
159155 ignore_patterns : Optional [Union [List [str ], str ]] = None ,
160156 ** kwargs ,
161157 ):
162- cls .push_to_hub (repo_id , folder_path , path_in_repo , commit_message , commit_description , token , True , revision ,
163- ignore_patterns )
158+ MSHub .push_to_hub (repo_id , folder_path , path_in_repo , commit_message , commit_description , token , True , revision ,
159+ ignore_patterns )
164160 return CommitInfo (
165161 commit_url = f'https://www.modelscope.cn/models/{ repo_id } /files' ,
166162 commit_message = commit_message ,
0 commit comments