address cr

This commit is contained in:
Yingda Chen
2025-02-20 12:21:18 +08:00
parent da3c3c1883
commit 562e57bb9c
2 changed files with 4 additions and 4 deletions

View File

@@ -9,7 +9,7 @@ from modelscope.hub.file_download import (dataset_file_download,
model_file_download)
from modelscope.hub.snapshot_download import (dataset_snapshot_download,
snapshot_download)
from modelscope.hub.utils.utils import convert_patterns, get_endpoint
from modelscope.hub.utils.utils import convert_patterns
from modelscope.utils.constant import DEFAULT_DATASET_REVISION

View File

@@ -138,8 +138,8 @@ class UploadCMD(CLICommand):
# Check token and login
# The cookies will be reused if the user has logged in before.
cookies = None
api = HubApi(endpoint=self.args.endpoint)
if self.args.token:
api = HubApi(endpoint=self.args.endpoint)
cookies = api.get_cookies(access_token=self.args.token)
else:
cookies = ModelScopeConfig.get_cookies()
@@ -159,7 +159,7 @@ class UploadCMD(CLICommand):
repo_type=self.args.repo_type,
commit_message=self.args.commit_message,
commit_description=self.args.commit_description,
cookies=cookies,
token=self.args.token,
)
elif os.path.isdir(self.local_path):
api.upload_folder(
@@ -172,7 +172,7 @@ class UploadCMD(CLICommand):
allow_patterns=convert_patterns(self.args.include),
ignore_patterns=convert_patterns(self.args.exclude),
max_workers=self.args.max_workers,
cookies=cookies,
token=self.args.token,
)
else:
raise ValueError(f'{self.local_path} is not a valid local path')