This commit is contained in:
Yingda Chen
2025-03-04 13:58:14 +08:00
parent a4c06da3c2
commit 4882cadc2e
2 changed files with 8 additions and 4 deletions

View File

@@ -718,10 +718,12 @@ class HubApi:
def get_valid_revision(self,
model_id: str,
revision=None,
cookies: Optional[CookieJar] = None):
cookies: Optional[CookieJar] = None,
endpoint: Optional[str] = None):
return self.get_valid_revision_detail(model_id=model_id,
revision=revision,
cookies=cookies)['Revision']
cookies=cookies,
endpoint=endpoint)['Revision']
def get_model_branches_and_tags_details(
self,

View File

@@ -359,8 +359,10 @@ def create_temporary_directory_and_cache(model_id: str,
return temporary_cache_dir, cache
def get_file_download_url(model_id: str, file_path: str, revision: str,
endpoint: str):
def get_file_download_url(model_id: str,
file_path: str,
revision: str,
endpoint: Optional[str] = None):
"""Format file download url according to `model_id`, `revision` and `file_path`.
e.g., Given `model_id=john/bert`, `revision=master`, `file_path=README.md`,
the resulted download url is: https://modelscope.cn/api/v1/models/john/bert/repo?Revision=master&FilePath=README.md