mirror of
https://github.com/modelscope/modelscope.git
synced 2025-12-16 16:27:45 +01:00
* update features * update api * add upload_file and thread_executor * update upload file * update api.py * add cli for uploading * run lint * lint in msdataset * temp * add tqdm_desc in thread_executor * update * refine upload_file and upload_folder * add endpoint for cli * add uploading checker * add path_or_fileobj and path_in_repo check in upload_file func * add size limit to lfs: 1MB by default * update lfs limit size: 10MB * 5MB lfs limit * fix test issue * add pbar for upload_blob; del size_to_chunk_mb; fix allow_patterns and ignore_patterns * fix commit uploaded blobs * add update action for folder * fix issues * add normal files check * update * update * set normal file size limit to 500MB * update tqdm
52 lines
1.5 KiB
Python
52 lines
1.5 KiB
Python
# Copyright (c) Alibaba, Inc. and its affiliates.
|
|
|
|
import argparse
|
|
import logging
|
|
|
|
from modelscope.cli.clearcache import ClearCacheCMD
|
|
from modelscope.cli.download import DownloadCMD
|
|
from modelscope.cli.llamafile import LlamafileCMD
|
|
from modelscope.cli.login import LoginCMD
|
|
from modelscope.cli.modelcard import ModelCardCMD
|
|
from modelscope.cli.pipeline import PipelineCMD
|
|
from modelscope.cli.plugins import PluginsCMD
|
|
from modelscope.cli.server import ServerCMD
|
|
from modelscope.cli.upload import UploadCMD
|
|
from modelscope.hub.api import HubApi
|
|
from modelscope.utils.logger import get_logger
|
|
|
|
logger = get_logger(log_level=logging.WARNING)
|
|
|
|
|
|
def run_cmd():
|
|
parser = argparse.ArgumentParser(
|
|
'ModelScope Command Line tool', usage='modelscope <command> [<args>]')
|
|
parser.add_argument(
|
|
'--token', default=None, help='Specify ModelScope SDK token.')
|
|
subparsers = parser.add_subparsers(help='modelscope commands helpers')
|
|
|
|
DownloadCMD.define_args(subparsers)
|
|
UploadCMD.define_args(subparsers)
|
|
ClearCacheCMD.define_args(subparsers)
|
|
PluginsCMD.define_args(subparsers)
|
|
PipelineCMD.define_args(subparsers)
|
|
ModelCardCMD.define_args(subparsers)
|
|
ServerCMD.define_args(subparsers)
|
|
LoginCMD.define_args(subparsers)
|
|
LlamafileCMD.define_args(subparsers)
|
|
|
|
args = parser.parse_args()
|
|
|
|
if not hasattr(args, 'func'):
|
|
parser.print_help()
|
|
exit(1)
|
|
if args.token is not None:
|
|
api = HubApi()
|
|
api.login(args.token)
|
|
cmd = args.func(args)
|
|
cmd.execute()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
run_cmd()
|