SuperAPI AI Directory

modelscope-cli

Agents & models

View repository

Updated 10-15 19:57

About this skill

Overview

The ModelScope CLI Skill provides batch download, integrity verification, parameter counting, and other features for models and datasets on the ModelScope platform, and supports multiple deployment scenarios such as Ascend NPU.

Core Value:

  • Batch download ModelScope models and datasets
  • Automatic environment detection and prerequisite verification
  • Network diagnostics and troubleshooting
  • SHA256 integrity verification
  • Intelligent counting of model parameters
  • Loop retry mechanism to handle network instability

Recommendation: For Ascend NPU deployment, it is recommended to first download optimized quantized models from the Eco-Tech organization . For details, see reference/ASCEND_MODELS.md。


Prerequisites

Required Environment

Dependency Version Requirement Check Command
Python >= 3.7 python3 --version
ModelScope CLI Latest version modelscope --version
Disk Space 100GB+ (recommended) df -h

Install ModelScope

# 推荐:清华镜像源
pip install modelscope -i https://pypi.tuna.tsinghua.edu.cn/simple

Network Requirements

  • External network access capability (or configured proxy)
  • Internal network environments require proxy and SSL certificate configuration. For details, see Proxy Configuration

Quick Start

Step 1: Environment Check

# 执行前置检查
bash scripts/run_preflight_check.sh

# 如检查失败,运行诊断
bash scripts/run_network_diagnose.sh

Step 2: Download Model

Edit scripts/run_ms_model_download.sh to configure the model list, then run:

bash scripts/run_ms_model_download.sh

Step 3: Verify Integrity

bash scripts/run_check_sha.sh ./models/Qwen-2B

Usage

Model Download

Configure Download List

Edit scripts/run_ms_model_download.sh:

# 模型列表
MODELS=(
  Qwen/Qwen3.5-2B-Base
  Eco-Tech/Qwen3.5-397B-A17B-w8a8-mtp
)

# 下载目录(请根据实际环境修改)
DIR="./models"

# 排除文件
EXCLUDE="*.onnx *.onnx_data"

Run Download

# 基本下载
bash scripts/run_ms_model_download.sh

# 循环重试(网络不稳定时推荐)
bash scripts/ms_loop.sh scripts/run_ms_model_download.sh

# 跳过前置检查
SKIP_PREFLIGHT=1 bash scripts/run_ms_model_download.sh

Use CLI Directly

# 下载模型
modelscope download --model 'Qwen/Qwen3.5-2B-Base' --local_dir ./models

# 下载数据集
modelscope download --dataset 'WorldVQA/WorldVQA' --local_dir ./datasets

# 排除文件
modelscope download --model 'Qwen/Qwen3.5-2B-Base' --exclude '*.onnx,*.onnx_data'

For more CLI usage, see reference/wiki.md。


Dataset Download

Edit scripts/run_ms_datasets_download.sh:

DATASETS=(
  WorldVQA/WorldVQA
)
DIR="./datasets"

Run:

bash scripts/run_ms_datasets_download.sh

Integrity Verification

# 校验单个模型
bash scripts/run_check_sha.sh ./models/Qwen-2B

# 校验会自动生成 .sha256sum 文件并验证

Parameter Counting

# 统计单个模型
bash scripts/run_report_param.sh ./models/Qwen-2B

# 统计目录下所有模型
bash scripts/run_report_param.sh ./models

Example output:

模型: Qwen-2B
========================================
权重文件数量: 2
模型总大小: 4.00 GB
数据精度: BF16/FP16 (每参数 2.0 字节)
推测参数量: 2.00 B (1-7B)

For the principle of parameter counting, see reference/wiki.md - Parameter Counting。


Network Diagnostics

# 完整诊断
bash scripts/run_network_diagnose.sh

Diagnostic Items:

  • Environment variables (proxy configuration)
  • DNS resolution
  • Ping connectivity
  • HTTP connection test
  • SSL certificate information
  • Python SSL test

For detailed troubleshooting methods for diagnostic results, see reference/wiki.md - Troubleshooting。


Proxy Configuration

# 交互式代理配置
bash scripts/setup_proxy.sh

This script supports:

  • Detecting existing proxy configuration
  • Interactively setting HTTP/HTTPS proxy
  • Persisting to ~/.bashrc
  • Optionally configuring pip mirror source

You can also set it manually:

export HTTP_PROXY=http://proxy-host:port
export HTTPS_PROXY=http://proxy-host:port

Loop Retry

Use loop retry when the network is unstable:

# 基本用法
bash scripts/ms_loop.sh scripts/run_ms_model_download.sh

# 自定义重试间隔(秒)
bash scripts/ms_loop.sh scripts/run_ms_model_download.sh 10

# 记录日志
bash scripts/ms_loop.sh scripts/run_ms_model_download.sh 5 2>&1 | tee download.log

Script Description
Script Function Usage Reference Document
run_preflight_check.sh Environment prerequisite check bash scripts/run_preflight_check.sh -
run_network_diagnose.sh Network diagnostics bash scripts/run_network_diagnose.sh wiki.md - Troubleshooting
run_ms_model_download.sh Batch download models bash scripts/run_ms_model_download.sh wiki.md - CLI Commands
run_ms_datasets_download.sh Batch download datasets bash scripts/run_ms_datasets_download.sh wiki.md - CLI Commands
run_check_sha.sh SHA256 verification bash scripts/run_check_sha.sh <目录> -
run_report_param.sh Parameter Count Statistics bash scripts/run_report_param.sh <目录> wiki.md - Parameter Count Calculation
ms_loop.sh Loop Retry bash scripts/ms_loop.sh <脚本> [间隔] -
setup_proxy.sh Proxy Configuration bash scripts/setup_proxy.sh wiki.md - Environment Configuration

Frequently Asked Questions

1. Pre-check Failed

Symptom: run_preflight_check.sh reports check failure

Solution:

# 运行诊断
bash scripts/run_network_diagnose.sh

# 根据诊断结果:
# - 代理未配置 → 运行 bash scripts/setup_proxy.sh 或手动设置环境变量
# - SSL 证书失败 → 安装证书或禁用验证
# - 网络不通 → 检查防火墙/代理

2. SSL Certificate Verification Failed

Cause: Internal self-signed certificate

Solution 1 - Install Certificate (Recommended):

# 将自签名 CA 证书添加到系统信任库
# CentOS/RHEL:
sudo cp your-ca.crt /etc/pki/ca-trust/source/anchors/
sudo update-ca-trust

# Ubuntu/Debian:
sudo cp your-ca.crt /usr/local/share/ca-certificates/
sudo update-ca-certificates

Solution 2 - Disable Verification:

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

3. Download Interrupted

Solution:

# 使用循环重试
bash scripts/ms_loop.sh scripts/run_ms_model_download.sh

# 断点续传(重新执行会自动跳过已下载文件)
bash scripts/run_ms_model_download.sh

4. Insufficient Disk Space

Solution:

# 检查空间
df -h

# 清理缓存
rm -rf ~/.cache/modelscope/hub/

# 修改下载目录
# 编辑 run_ms_model_download.sh 中的 DIR 变量

5. Model ID Not Found

Solution:


Related Resources

Official Documentation

Recommended Model Organizations

Organization Link Description
Eco-Tech Link Ascend optimized quantized models
vllm-ascend Link vLLM-Ascend benchmark models
Qwen Link Tongyi Qianwen series
ZhipuAI Link Zhipu GLM series

For more model recommendations, see reference/ASCEND_MODELS.md。

Reference Documentation