Skip to content

ModelScope

Qubitium edited this page Dec 3, 2026 · 3 revisions

ModelScope

Full signatures and usage: ModelScope compatibility.

Select provider="modelscope" to resolve an individual model file, dataset shard or whole snapshot through ModelScope’s native API. ModelScope requests use an owner/repository ID. Revisions default to master; the HF provider defaults to main.

from datashoal import load

path = load("Qwen/Qwen2.5-0.5B", type="model", provider="modelscope",
            file="config.json", download=True)
offline_path = load("Qwen/Qwen2.5-0.5B", type="model", provider="modelscope",
                    file="config.json")
assert offline_path == path

For a dataset, choose a shard by filename. Supported files open as native row streams. Use the following functions from datashoal.modelscope_compat when a consumer needs a string path.

Function Resolves
model_file_download(model_id, file_path, revision=None, ...) A single model file
dataset_file_download(dataset_id, file_path, *, revision=None, ...) A single dataset file
snapshot_download(model_id=None, revision=None, *, repo_id=None, repo_type="model", ...) A model or dataset snapshot
dataset_snapshot_download(dataset_id, revision=None, ...) A dataset snapshot

All four accept keyword options cache_dir, token, local_files_only=True, and endpoint. Set local_files_only=False to permit a cache fill. The provider uses MODELSCOPE_API_TOKEN and accepts official HTTPS endpoints at modelscope.cn and modelscope.ai, including their www variants. MODELSCOPE_ENDPOINT supplies the default endpoint override.

Reuse an SDK cache

The cache root is chosen from cache_dir, MODELSCOPE_CACHE, MS_CACHE_HOME, then ~/.cache/modelscope. Files live under {models,datasets}/owner--repo/snapshots/revision. A single SDK-cached file can open offline. DataShoal requires its repository inventory before declaring a complete snapshot. An initial online snapshot load can populate the inventory and reuse matching files. New downloads are verified against the listed size and SHA-256. For native forced refresh use download=DownloadConfig(force=True).

Loading reference · Troubleshooting

Clone this wiki locally