Install
Install the modelscope package:
pip install modelscopeOn macOS, the default download location is ~/.cache/modelscope/hub. To change it, set the MODELSCOPE_CACHE environment variable in ~/.zshrc:
export MODELSCOPE_CACHE=/path/to/your/cacheNotes
-
If the path given to
local_dirdoes not exist, the tool creates it automatically. -
local_dirmust be an absolute path. Do not use~for the home directory: Python'sopen()does not expand it, and the command fails withNo such file or directory. -
The quick start in the official docs uses the form
--model="Qwen/Qwen2.5-0.5B-Instruct". Prefer the spaced form--model <model_repo_id>instead. -
<model_repo_id>is the model repository ID from the model page. It is made of the organization name and the model name, for exampleQwen/Qwen-Image-2.1. -
Downloading a private model requires you to log in.
Download specific files to a directory
modelscope download --model '<model_repo_id>' '<file_path>' --local_dir '<local_dir>'
# Example: download one weight file to a given directory
modelscope download --model 'Qwen/Qwen-Image-2.1-Turbo' 'transformer/diffusion_pytorch_model-00001-of-00002.safetensors' --local_dir '/Users/oceanz/MyFiles/models/Qwen/Qwen-Image-2.1-Turbo'-
<file_path>must keep the file's relative path inside the repository. -
Separate multiple files with spaces.
Download a full repository to the default cache
modelscope download --model '<model_repo_id>'Download a full repository to a given directory
modelscope download --model '<model_repo_id>' --local_dir '<local_dir>'
# Example
modelscope download --model 'Qwen/Qwen-Image-2.1-Turbo' --local_dir '/Users/oceanz/MyFiles/models/Qwen/Qwen-Image-2.1-Turbo'Parameters
| Parameter | Short | Type | Default | Description |
|---|---|---|---|---|
repo_id | - | str | - | Positional argument: repository ID (optional; can also be set with --model) |
files | - | str | - | Positional argument: files to download (multiple files allowed) |
--model | - | str | None | Model ID (mutually exclusive with --dataset) |
--dataset | - | str | None | Dataset ID (mutually exclusive with --model) |
--repo-type | - | choice | model | Repository type (model or dataset), used with the positional repo_id |
--revision | - | str | None | Revision, branch, or tag |
--cache_dir | - | str | None | Cache directory |
--local_dir | - | str | None | Local directory (takes priority over cache_dir) |
--include | - | list | None | Glob patterns for files to include |
--exclude | - | list | None | Glob patterns for files to exclude |
--token | - | str | None | Access token (required for private models) |
--endpoint | - | str | None | ModelScope service endpoint |
--max-workers | - | int | default | Maximum number of concurrent download threads |