The official Python SDK & CLI for ModelScope Hub — download, upload, and manage AI assets from one unified interface.
Why modelscope-hub?
modelscope-hub connects your code to the ModelScope ecosystem — models, datasets, Studio spaces, skills, and MCP servers — through a single HubApi class or the ms-hub CLI.
- Unified repo interface — one set of methods for models, datasets, studios, skills, and MCP servers
- OpenAPI-first — built on the ModelScope OpenAPI surface with transparent legacy fallback
- Production-grade downloads — HTTP Range resume, parallel range download for large files, per-file retry with backoff, SHA256 integrity checks, file lock for multiprocess safety, offline mode, progress callbacks, and intra-cloud acceleration
- Full lifecycle CLI — download, upload, deploy, manage secrets, inspect cache — all from the terminal
- Deep ecosystem integration — seamless access to 100K+ models and datasets on ModelScope Hub; works with the
modelscopetraining framework, Studio deployment platform, and MCP server infrastructure
News
v0.2.0 (2026-08-01)
- Breaking:
HubApi.login()now raisesNetworkError/ServerError/RequestTimeoutErrorfor non-authentication failures instead of always raisingAuthenticationError— widenexcept AuthenticationErrortoHubErrorif you catch any login failure - Fix: network, timeout and 5xx errors during login are no longer misreported as an invalid token; a failed login no longer deletes stored credentials; bare and upper-case endpoints are accepted (e.g.
--endpoint modelscope.ai) - Enhancement: a rejected login probes the peer ModelScope site and suggests
--endpointwhen the token is valid there;--verboseprints the full error cause chain
v0.1.9 (2026-07-31)
- Fix: two stale unit tests that failed in downstream distro sandboxes (#46, NixOS): align the
mcp deploycall-shape assertion and theparse_timestamptimezone-normalization contract - Feature:
ms-hub mcp deployprints the operational URL after deployment; new--auth-checkand repeatable--env KEY=VALUEoptions;--transport-typenow validates againstsse/streamable_http - CI: new
citestworkflow — mock-mode test suite (no credentials/network, mirrors distro build sandboxes) on Python 3.10/3.12/3.14 plus ruff/mypy hard gates; releases now require a green test gate before publishing; added apre-commitconfig - Quality: ruff & mypy debt cleared to zero; lint/type-check targets aligned to the supported Python floor (3.10)
v0.1.8 (2026-07-21)
- Feature:
ms-hub agentraw file transfer (download/upload/list) for remote agent repos; visibility support for agent hub; cache checksum verification (ms-hub cache verify) - Fix: forward
progress_callbacksthroughHubApi.download_reposo custom download-progress callbacks work end-to-end; harden legacy (pre-1.38) cache auto-detection (reuse existing{cache}/models/...and default{cache}/hub/models/...layouts); normal (non-LFS) file upload - Packaging: rename console scripts to
modelscope-hub/ms-hubto avoid a file conflict with themodelscopepackage (e.g. FreeBSD pkg)
Older releases
v0.1.7 (2026-07-07)
- Feature: intra-/inter-region cloud download acceleration, with a source marker in the progress bar
- Fix: align
snapshot_downloadcache path with the CLI; add legacy cache fallback - Refactor: inter-region config via env var only (removed the
--inter-regionsCLI arg); cache the region probe
v0.1.6 (2026-07-03)
- Refactor: replace the extra-field whitelist with a reserved-field blocklist for more permissive param passthrough
v0.1.5 (2026-06-30)
- Fix: adaptive commit batch size for uploads
v0.1.4 (2026-06-26)
- Feature:
gated_modeparameter forcreate_repo;ms-hub create --gated/--no-gatedflags - Refactor: unify visibility / gated_mode semantics in the SDK layer
- Fix:
create_repoextra-kwargs whitelist + type validation; correct visibility mapping (privatebool is authoritative)
v0.1.3 (2026-06-23)
- Feature: add
AlreadyExistsError(E3026) and fix theexist_okmechanism; alignlist_repos/RepoInfowith the OpenAPI response format - Fix:
clear-cachesupports all cache layouts (standard/flat/legacy); addlast_modifiedmapping andto_dict()forRepoInfo/PagedResult
v0.1.2 (2026-06-23)
- Fix: unify
list_datasets/get_datasetreturn format and align parameters
v0.1.1 (2026-06-22)
- Fix: legacy API for msdatasets loading
v0.1.0 (2026-06-18)
- Feature: Configurable upload failure thresholds (consecutive failures & total wait time)
- Fix: compatibility && error handling
- Legacy cache path compatibility — compat layer preserves flat
{cache_dir}/{owner}/{name}/layout - Type safety in legacy path resolution (handle both
strandPathconfig values) - Improved error handling and response normalization in compatibility APIs
- Legacy cache path compatibility — compat layer preserves flat
v0.0.9 (2026-06-12)
- Feature:
get_modelsupportrevision; expanded param passthrough for repo/model ops - Fix: Pattern normalization accepts iterable inputs (tuple, etc.);
parse_timestamprobust timezone conversion for ISO 8601, floats, milliseconds
v0.0.8 (2026-06-10)
- Feature:
ms-hub list --allauto-pagination;ms-hub create --skill-filezip upload;ms-hub list --envs - Fix: Download per-file lock & stale detection & atomic merge;
--disable-tqdmfor folder upload - Security: Redact tokens from git/API error output
- Refactor: Centralize env var registry; unify
MODELSCOPE_DOMAIN→MODELSCOPE_ENDPOINT
v0.0.5 (2026-06-05)
- Fix
list_repospagination and dataset visibility issues - OpenAPI spec alignment: pagination limits, retry, auth, request body
v0.0.4 (2026-06-05)
- Flatten CLI to top-level commands (
ms-hub create/info/list/delete) - Migrate credentials to
~/.modelscope/credentials/ - Fix dataset/skill download, blob upload auth, error code refactor
Installation
pip install modelscope-hub
Requires Python 3.10+. Lightweight — only requests, tqdm, filelock, urllib3.
Quick Start
Authenticate
ms-hub login
# or pass a token directly
ms-hub login --token $MODELSCOPE_API_TOKEN
Get your token at modelscope.cn/my/access/token or modelscope.ai/my/access/token.
from modelscope_hub import HubApi
api = HubApi(token="your-token")
user = api.whoami()
print(user.username)
Download
# Full snapshot
ms-hub download Qwen/Qwen3-0.6B
# Single file
ms-hub download Qwen/Qwen3-0.6B config.json
# With filters
ms-hub download Qwen/Qwen3-0.6B --include "*.safetensors" --exclude "*.bin"
# Directly into a local directory (bypasses cache)
ms-hub download Qwen/Qwen3-0.6B --local-dir ./my-model
path = api.download_file("Qwen/Qwen3-0.6B", "model", "config.json")
snapshot = api.download_repo(
"Qwen/Qwen3-0.6B", "model",
allow_patterns=["*.safetensors", "*.json"],
max_workers=8,
)
# Offline mode — return cached path without network access
path = api.download_file("Qwen/Qwen3-0.6B", "model", "config.json", local_files_only=True)
Upload
ms-hub upload my-org/my-model ./weights.safetensors
ms-hub upload my-org/my-model ./output --repo-type model --commit-message "add weights"
api.upload_file("my-org/my-model", "model", "./weights.safetensors", "weights.safetensors")
api.upload_folder("my-org/my-model", "model", "./output", path_in_repo="")
Create a Repository
ms-hub create my-org/my-model --repo-type model --visibility private
api.create_repo("my-org/my-model", "model", visibility="private", license="apache-2.0")
Deploy a Studio
ms-hub deploy my-org/chat-demo --repo-type studio
ms-hub logs my-org/chat-demo --log-type run
ms-hub stop my-org/chat-demo --repo-type studio
api.deploy_repo("my-org/chat-demo", "studio")
api.get_repo_logs("my-org/chat-demo", log_type="run")
api.stop_repo("my-org/chat-demo", "studio")
CLI Reference
The CLI is available as both ms-hub and modelscope-hub.
Global options (placed before or after the subcommand):
| Option | Description |
|---|---|
--token TOKEN |
API token (overrides env and persisted token) |
--endpoint URL |
API endpoint (default: https://modelscope.cn) |
-v, --verbose |
Enable DEBUG logging (global only) |
-V, --version |
Print version and exit (global only) |
--tokenand--endpointcan be placed either before or after the subcommand:ms-hub --token xxx download ...andms-hub download ... --token xxxare equivalent.
ms-hub login
Authenticate and persist your token locally.
ms-hub login # interactive prompt
ms-hub login --token $MY_TOKEN # non-interactive
| Option | Description |
|---|---|
--token TOKEN |
API token; prompted interactively if omitted |
ms-hub whoami
Show the user associated with the current token.
ms-hub whoami
ms-hub whoami --token $MY_TOKEN # check a specific token without logging in
ms-hub download
Download a single file or a full repository snapshot.
ms-hub download Qwen/Qwen3-0.6B # full snapshot
ms-hub download Qwen/Qwen3-0.6B config.json # single file
ms-hub download Qwen/Qwen3-0.6B --include "*.safetensors" # filter by glob
ms-hub download Qwen/Qwen3-0.6B --local-dir ./out --max-workers 8 # direct download
ms-hub download my-org/my-data --repo-type dataset --revision v2 # dataset at tag
| Argument / Option | Required | Description |
|---|---|---|
repo_id |
yes | Repository identifier (owner/name) |
files... |
no | Specific file paths; omit for full snapshot |
--repo-type {model,dataset} |
no | Default: model |
--revision REV |
no | Branch, tag, or commit hash (default: master) |
--local-dir DIR |
no | Download directly here (bypasses cache layout) |
--cache-dir DIR |
no | Override default cache directory |
--include GLOB... |
no | Only download matching files; repeatable |
--exclude GLOB... |
no | Skip matching files; repeatable |
--max-workers N |
no | Parallel download threads (default: 4) |
--force |
no | Re-download even if cached |
Advanced examples
# Download multiple specific files at once
ms-hub download Qwen/Qwen3-0.6B config.json tokenizer.json generation_config.json
# Download only safetensors, skip GGUF and bin weights
ms-hub download Qwen/Qwen3-0.6B --include "*.safetensors" --exclude "*.bin" "*.gguf"
# Download a dataset at a specific tag into a local directory
ms-hub download my-org/my-data --repo-type dataset --revision v2 --local-dir ./data
# Use a custom cache directory and 8 parallel threads
ms-hub download Qwen/Qwen3-0.6B --cache-dir /data/hub-cache --max-workers 8
# Force re-download even if already cached
ms-hub download Qwen/Qwen3-0.6B config.json --force
# Download all skills from a collection (legacy flag)
ms-hub download --collection my-org/skill-collection
# Enable parallel range download for large files (env var)
MODELSCOPE_DOWNLOAD_PARALLELS=4 ms-hub download Qwen/Qwen3-0.6B
# Use the modelscope.ai endpoint (global option, before subcommand)
ms-hub --endpoint https://modelscope.ai download Qwen/Qwen3-0.6B
ms-hub upload
Upload a file or folder to a repository.
ms-hub upload my-org/my-model ./weights.safetensors # single file
ms-hub upload my-org/my-model ./output models/ --repo-type model # folder → subdir
ms-hub upload my-org/my-model . --include "*.py" --commit-message "code" # filtered folder
| Argument / Option | Required | Description |
|---|---|---|
repo_id |
yes | Repository identifier |
local_path |
no | Local file or folder (default: inferred from repo name) |
path_in_repo |
no | Destination path inside the repo |
--repo-type {model,dataset} |
no | Default: model |
--revision REV |
no | Target branch (default: master) |
--commit-message MSG |
no | Commit message |
--commit-description DESC |
no | Extended commit description |
--include GLOB... |
no | Include filter for folder mode; repeatable |
--exclude GLOB... |
no | Exclude filter for folder mode; repeatable |
--max-workers N |
no | Parallel upload threads |
--use-cache / --no-cache |
no | Enable/disable resumable upload cache (default: on) |
--disable-tqdm |
no | Disable progress bars |
Advanced examples
# Upload a single file with a custom commit message
ms-hub upload my-org/my-model ./weights.safetensors --commit-message "add fp16 weights"
# Upload a folder into a subdirectory of the repo
ms-hub upload my-org/my-model ./output models/ --repo-type model
# Upload only Python files from the current directory
ms-hub upload my-org/my-model . --include "*.py" --commit-message "update code"
# Upload only safetensors, skip checkpoints
ms-hub upload my-org/my-model ./output --include "*.safetensors" --exclude "*.ckpt" "*.bin"
# Upload to a dataset repo on a specific branch
ms-hub upload my-org/my-data ./data --repo-type dataset --revision dev
# Upload with extended commit description
ms-hub upload my-org/my-model ./weights.safetensors \
--commit-message "v2 weights" \
--commit-description "Retrained with extended dataset, 3 epochs, lr=2e-5"
# Resumable upload: interrupted uploads resume automatically via cache
ms-hub upload my-org/my-model ./large-folder
# If interrupted, just re-run the same command — already uploaded files are skipped
# Disable upload cache (no resume, fresh upload every time)
ms-hub upload my-org/my-model ./output --no-cache
# Disable progress bars (useful for CI/CD pipelines)
ms-hub upload my-org/my-model ./output --disable-tqdm
ms-hub create / ms-hub info / ms-hub list / ms-hub delete
Repository management.
ms-hub create my-org/my-model --repo-type model --visibility private
ms-hub create my-org/demo --repo-type studio --sdk-type gradio
ms-hub info my-org/my-model --repo-type model
ms-hub list --repo-type model --owner my-org --page-size 20
ms-hub delete my-org/my-model --repo-type model --yes
Deprecation notice:
delete_repo/ms-hub deleteemits aDeprecationWarning— programmatic repo deletion is restricted for security reasons and will be restored once token-scoped auth is available. Use the web console to delete repos.
delete_filesrequires cookie-based session auth; API tokens may receive a 401 error.
ms-hub create options
| Argument / Option | Required | Description |
|---|---|---|
repo_id |
yes | Repository identifier |
--repo-type |
yes | model, dataset, studio, or skill |
--visibility |
no | public, private, or internal |
--license |
no | SPDX license identifier (e.g. apache-2.0) |
--chinese-name |
no | Display name in Chinese |
--description |
no | Repository description |
--exist-ok |
no | No error if repository already exists |
--sdk-type |
no | Studio SDK: gradio, streamlit, docker, static |
--sdk-version |
no | Studio SDK version |
--base-image |
no | Studio base Docker image |
--cover-image |
no | Studio cover image URL |
--hardware |
no | Studio hardware spec |
ms-hub deploy / ms-hub stop / ms-hub logs / ms-hub settings
Manage Studio and MCP deployments.
ms-hub deploy my-org/chat-demo --repo-type studio
ms-hub logs my-org/chat-demo --log-type run --keyword ERROR --page-size 50
ms-hub settings my-org/chat-demo cpu=4 memory=8192
ms-hub stop my-org/chat-demo --repo-type studio
Options
| Command | --repo-type |
Key Options |
|---|---|---|
ms-hub deploy <repo_id> |
{studio,mcp} (default: studio) |
— |
ms-hub stop <repo_id> |
{studio,mcp} (default: studio) |
— |
ms-hub logs <repo_id> |
{studio} only |
--log-type {run,build}, --keyword, --page, --page-size |
ms-hub settings <repo_id> key=val... |
{studio,skill} (default: studio) |
Key-value pairs passed to backend |
Note:
ms-hub logsonly supports Studio spaces. MCP server logs are not available via this command.ms-hub settingssupports Studio and Skill repos; for MCP servers usems-hub mcp deploywith configuration payload.
ms-hub secret
Manage secrets for Studio spaces (studio only, --repo-type defaults to studio).
ms-hub secret add my-org/demo API_KEY sk-xxx
ms-hub secret list my-org/demo
ms-hub secret update my-org/demo API_KEY sk-new
ms-hub secret delete my-org/demo API_KEY --yes
Subcommands
| Subcommand | Arguments | Description |
|---|---|---|
add |
repo_id key value |
Add a new secret |
list |
repo_id |
List all secret keys |
update |
repo_id key value |
Update a secret value |
delete |
repo_id key [--yes] |
Delete a secret |
All subcommands accept --repo-type (default: studio, currently the only supported type).
ms-hub mcp
Manage MCP (Model Context Protocol) servers.
ms-hub mcp list --search weather --page-size 10
ms-hub mcp info my-org/weather-mcp
ms-hub mcp deploy my-org/weather-mcp
ms-hub mcp undeploy my-org/weather-mcp
Subcommands
| Subcommand | Arguments | Key Options |
|---|---|---|
list |
— | --search, --page, --page-size |
info |
server_id |
— |
deploy |
server_id |
— |
undeploy |
server_id |
— |
ms-hub cache
Inspect and clean the local download cache.
ms-hub cache scan
ms-hub cache scan --cache-dir /data/cache
ms-hub cache verify Qwen/Qwen3-0.6B
ms-hub cache verify Qwen/Qwen3-0.6B --local-dir ./Qwen3-0.6B
ms-hub cache clear --repo-type model --yes
ms-hub cache clear --repo-id my-org/old-model --repo-type model --yes
Options
| Subcommand | Key Options |
|---|---|
scan |
--cache-dir DIR |
verify REPO_ID |
--repo-type, --revision, --cache-dir, --local-dir, --fail-on-missing-files, --fail-on-extra-files |
clear |
--repo-type, --repo-id, --cache-dir, --yes |
ms-hub agent
Low-level raw file transfer for remote agent repositories: download, upload, list. This command transfers files as-is, with no framework awareness.
ms-hub agent download -r user/my-agent --local-dir ./my-agent # download raw files
ms-hub agent upload -r user/my-agent --local-dir ./my-agent # upload raw
Framework-aware operations (cross-framework
convert,watch/bidirectional sync,status,backups,restore,stop) live in modelscope-agent — usems-agent agent ...instead. For example, to download and convert in one step:ms-agent agent download -f qoder -r user/my-agent --target-framework qwenpaw.
Subcommands
ms-hub agent download
Download all files of a remote agent repository to a local directory (raw, no conversion).
ms-hub agent download -r user/my-agent
ms-hub agent download -r user/my-agent --local-dir ./my-agent --revision master
| Option | Required | Description |
|---|---|---|
-r, --repo REPO |
yes | Remote repo identifier (owner/name) |
--local-dir DIR |
no | Destination directory (default: ./<repo-name> under CWD) |
--revision REV |
no | Repository revision (default: master) |
ms-hub agent upload
Upload files from a local path (file or directory) to a remote agent repository (raw, no conversion). Creates the repo if it does not exist.
ms-hub agent upload -r user/my-agent --local-dir ./my-agent
ms-hub agent upload -r user/my-agent --local-dir ./my-agent --dry-run
| Option | Required | Description |
|---|---|---|
-r, --repo REPO |
yes | Remote repo identifier (owner/name) |
--local-dir DIR |
no | Source path (file or directory) to upload (default: CWD) |
--revision REV |
no | Repository revision (default: master) |
--dry-run |
no | List files that would be uploaded without uploading |
SDK API Overview
All operations go through a single entry point:
from modelscope_hub import HubApi
# Connect to modelscope.cn (default)
api = HubApi(token="...")
# Or connect to modelscope.ai
api = HubApi(token="...", endpoint="https://modelscope.ai")
Full method reference
| Category | Method | Description |
|---|---|---|
| Auth | login(token) |
Persist and verify token |
logout() |
Clear stored credentials | |
whoami() |
Get current user info | |
| Repo | create_repo(repo_id, repo_type, ...) |
Create a repository |
get_repo(repo_id, repo_type) |
Get repository metadata | |
list_repos(repo_type, ...) |
Paginated listing | |
delete_repo(repo_id, repo_type) |
Delete a repository (deprecated — see note below) | |
repo_exists(repo_id, repo_type) |
Check existence | |
| Files | upload_file(repo_id, repo_type, local, remote) |
Upload a single file |
upload_folder(repo_id, repo_type, folder, ...) |
Upload a directory | |
download_file(repo_id, repo_type, file, ...) |
Download a single file (with retry, resume, offline mode) | |
download_repo(repo_id, repo_type, ...) |
Download full snapshot (parallel, file lock, progress callbacks) | |
list_repo_files(repo_id, repo_type) |
List files in a repo | |
delete_files(repo_id, repo_type, paths) |
Remove files (cookie-auth only) | |
| Version | list_repo_revisions(repo_id, repo_type) |
List branches and tags |
create_repo_tag(repo_id, repo_type, tag) |
Create a tag | |
| Deploy | deploy_repo(repo_id, repo_type) |
Deploy Studio or MCP |
stop_repo(repo_id, repo_type) |
Stop deployment | |
get_repo_logs(repo_id, ...) |
Fetch logs | |
update_repo_settings(repo_id, repo_type, ...) |
Update settings | |
| Secrets | add_secret(repo_id, key, value) |
Add a secret |
list_secrets(repo_id) |
List secrets | |
update_secret(repo_id, key, value) |
Update a secret | |
delete_secret(repo_id, key) |
Delete a secret | |
| MCP | list_mcp_servers(...) |
List available MCP servers |
get_mcp_server(server_id) |
Get server details | |
deploy_mcp_server(server_id) |
Deploy an MCP server | |
undeploy_mcp_server(server_id) |
Undeploy an MCP server | |
| Cache | scan_cache(cache_dir) |
Inspect local cache |
clear_cache(cache_dir, ...) |
Free disk space |
Deletion restrictions:
delete_repois deprecated for security reasons (emitsDeprecationWarning). Will be restored with token-scoped auth. Use the web console instead.delete_filesrequires cookie-based session auth; API tokens (ms-...) may receive a 401 error.
Ecosystem Integration
modelscope-hub is the hub connectivity layer for the ModelScope ecosystem:
┌────────────────────────────────────────────────┐
│ ModelScope Platform │
│ modelscope.cn · modelscope.ai │
│ │
│ Models · Datasets · Studios · Skills · MCP │
└───────────────────┬────────────────────────────┘
│ OpenAPI / Legacy API
▼
┌───────────────┐
│ modelscope-hub│ ← this library
│ SDK + CLI │
└───┬───────┬───┘
│ │
┌───────┘ └────────┐
▼ ▼
modelscope framework your application
(training · eval) (inference · deploy)
- Browse & discover — search 100K+ models and datasets via
list_repos/ms-hub repo list - Download & cache — pull model weights, tokenizer configs, or entire datasets into a managed cache or a local directory; supports offline mode via
local_files_only - Train & fine-tune — use with the modelscope framework: train locally, then push results back
- Deploy — launch a Studio space or MCP server directly from the CLI or SDK
- Automate — integrate into CI/CD pipelines with environment-variable auth and
--yesflags for non-interactive operation
Configuration
Run ms-hub list --envs to see all configurable environment variables with their current values.
Token is persisted locally after ms-hub login and auto-loaded in subsequent sessions.
Environment variables
Core:
| Variable | Default | Description |
|---|---|---|
MODELSCOPE_API_TOKEN |
— | API authentication token |
MODELSCOPE_ENDPOINT |
https://modelscope.cn |
API endpoint URL |
MODELSCOPE_CACHE |
~/.cache/modelscope |
Local cache directory |
MODELSCOPE_HOME |
~/.modelscope |
SDK config directory |
MODELSCOPE_PREFER_AI_SITE |
false |
Prefer modelscope.ai over modelscope.cn |
Network:
| Variable | Default | Description |
|---|---|---|
MODELSCOPE_API_TIMEOUT |
60 |
HTTP request timeout (seconds) |
MODELSCOPE_API_CONNECT_TIMEOUT |
10 |
HTTP connect timeout (seconds) |
MODELSCOPE_API_MAX_RETRIES |
5 |
Max retry attempts for transient failures |
Download:
| Variable | Default | Description |
|---|---|---|
MODELSCOPE_DOWNLOAD_PARALLEL_WORKERS |
1 |
Parallel range-download streams |
MODELSCOPE_DOWNLOAD_PARALLEL_THRESHOLD_MB |
500 |
Parallel download threshold (MB) |
MODELSCOPE_DOWNLOAD_CHUNK_SIZE_MB |
1 |
Streaming chunk size (MB) |
MODELSCOPE_DOWNLOAD_PART_SIZE_MB |
160 |
Parallel range chunk size (MB) |
MODELSCOPE_DOWNLOAD_MAX_RETRIES |
5 |
Per-file download retry count |
MODELSCOPE_DOWNLOAD_TIMEOUT |
60 |
Per-file download timeout (seconds) |
MODELSCOPE_DOWNLOAD_FILE_LOCK |
true |
File lock for multiprocess download safety |
MODELSCOPE_DOWNLOAD_INTRA_CLOUD |
true |
Alibaba cloud intra-cloud acceleration |
MODELSCOPE_DOWNLOAD_INTRA_CLOUD_REGION |
(auto) | Override intra-cloud region ID |
MODELSCOPE_DOWNLOAD_INTER_CLOUD_REGIONS |
Comma-separated peer regions for cross-region internal acceleration (e.g. cn-hangzhou,cn-zhangjiakou) |
Upload:
| Variable | Default | Description |
|---|---|---|
MODELSCOPE_UPLOAD_MAX_WORKERS |
min(8, cpu+4) |
Default parallel worker threads |
MODELSCOPE_UPLOAD_CACHE |
true |
Enable resumable upload cache |
MODELSCOPE_UPLOAD_MAX_FILE_SIZE_MB |
102400 |
Max single file size (MB, default 100 GB) |
MODELSCOPE_UPLOAD_MAX_FILE_COUNT |
100000 |
Max total files per upload |
MODELSCOPE_UPLOAD_CONNECT_TIMEOUT |
30 |
Upload connect timeout (seconds) |
MODELSCOPE_UPLOAD_READ_TIMEOUT |
3600 |
Upload read timeout (seconds) |
Logging:
| Variable | Default | Description |
|---|---|---|
MODELSCOPE_LOG_LEVEL |
INFO |
SDK log level (DEBUG/INFO/WARNING/ERROR) |
MODELSCOPE_NO_DEPRECATION_WARNINGS |
— | Suppress deprecation warnings |
Old variable names (e.g.
API_TIMEOUT,DOWNLOAD_RETRY_TIMES,UPLOAD_USE_CACHE) are still accepted but emit aFutureWarning. Runms-hub list --envsto see which deprecated names are active in your environment.
Backward Compatibility
modelscope-hub provides a compatibility layer for code written against the old modelscope.hub API surface. The old SDK can delegate directly to modelscope_hub.compat:
from modelscope_hub.compat import snapshot_download, model_file_download
from modelscope_hub.compat import LegacyHubApi as HubApi
All legacy parameter names (allow_file_pattern, ignore_file_pattern, cookies, etc.) are accepted and mapped to the new implementation.
Development
git clone https://github.com/modelscope/modelscope_hub.git
cd modelscope_hub
make install # pip install -e ".[dev]"
make test # unit tests (no network)
make lint # ruff check
make typecheck # mypy
See make help for all available targets.
License
Apache 2.0 — see LICENSE.
Citation
@Misc{modelscope-hub,
title = {modelscope-hub: The official Python client to connect with ModelScope Hub.},
author = {The ModelScope Team},
howpublished = {\url{https://github.com/modelscope/modelscope_hub}},
year = {2026}
}
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file modelscope_hub-0.2.0.tar.gz.
File metadata
- Download URL: modelscope_hub-0.2.0.tar.gz
- Upload date:
- Size: 163.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00288d3e08ad7fadfdd7539f4dffa9d75f9006c43c73abd33ea51767317f001c
|
|
| MD5 |
cb1e774c3a10dcf6e10ced5a8971c36a
|
|
| BLAKE2b-256 |
769d3fabfd2b147d94e1980d670fecd3c183999db04a71b80a546bcf37cc6f89
|
File details
Details for the file modelscope_hub-0.2.0-py3-none-any.whl.
File metadata
- Download URL: modelscope_hub-0.2.0-py3-none-any.whl
- Upload date:
- Size: 156.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84668c80c1d36d1fb1ea1ce17b707d77e044b92255288618c3b7de5b13834418
|
|
| MD5 |
3d85a3d9760edf9da9a53f089607530c
|
|
| BLAKE2b-256 |
abbe3b0e14c296a622c920287fc6d2c1b5a8668c8e0d98662f7b2bd8f3fcc779
|