modelscope安装并下载模型文件
目录
1. 安装modescope工具
2. 下载模型文件
大模型开发过程中,一般需要下载模型文件,在国内经常使用modescope工具,首先需要安装modescope工具
1. 安装modescope工具
安装时指定国内的源,执行下列命令:
pip install modelscope -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
输出以下内容,表示工具安装成功
Looking in indexes: https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
Collecting modelscopeDownloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/8e/6e/50fed6b37503accb0199153d3c18884380797b40491b11bd03279cd2d698/modelscope-1.26.0-py3-none-any.whl (5.9 MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.9/5.9 MB 10.0 MB/s eta 0:00:00
Collecting requests>=2.25 (from modelscope)Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/f9/9b/335f9764261e915ed497fcdeb11df5dfd6f7bf257d4a6a2a686d80da4d54/requests-2.32.3-py3-none-any.whl (64 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 64.9/64.9 kB 214.2 kB/s eta 0:00:00
Collecting tqdm>=4.64.0 (from modelscope)Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/d0/30/dc54f88dd4a2b5dc8a0279bdd7270e735851848b762aeb1c1184ed1f6b14/tqdm-4.67.1-py3-none-any.whl (78 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.5/78.5 kB 1.5 MB/s eta 0:00:00
Collecting urllib3>=1.26 (from modelscope)Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/6b/11/cc635220681e93a0183390e26485430ca2c7b5f9d33b15c74c2861cb8091/urllib3-2.4.0-py3-none-any.whl (128 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 128.7/128.7 kB 1.5 MB/s eta 0:00:00
Collecting charset-normalizer<4,>=2 (from requests>=2.25->modelscope)Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/8c/73/6ede2ec59bce19b3edf4209d70004253ec5f4e319f9a2e3f2f15601ed5f7/charset_normalizer-3.4.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (148 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 148.6/148.6 kB 1.5 MB/s eta 0:00:00
Collecting idna<4,>=2.5 (from requests>=2.25->modelscope)Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/76/c6/c88e154df9c4e1a2a66ccf0005a88dfb2650c1dffb6f5ce603dfbd452ce3/idna-3.10-py3-none-any.whl (70 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 70.4/70.4 kB 202.7 kB/s eta 0:00:00
Collecting certifi>=2017.4.17 (from requests>=2.25->modelscope)Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/4a/7e/3db2bd1b1f9e95f7cddca6d6e75e2f2bd9f51b1246e546d88addca0106bd/certifi-2025.4.26-py3-none-any.whl (159 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 159.6/159.6 kB 369.1 kB/s eta 0:00:00
Installing collected packages: urllib3, tqdm, idna, charset-normalizer, certifi, requests, modelscope
Successfully installed certifi-2025.4.26 charset-normalizer-3.4.2 idna-3.10 modelscope-1.26.0 requests-2.32.3 tqdm-4.67.1 urllib3-2.4.0
2. 下载模型文件
验证效果,尝试下载以下Qwen3-32B模型,执行命令:
modelscope download --model 'Qwen3-32B' --local_dir '/home/model/Qwen3-32B'
指定将下载的模型文件,存储在 /home/model/Qwen3-32B 目录,显示类似下面的信息,表示模型文件下载成功了
Downloading [config.json]: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 795/795 [00:00<00:00, 1.88kB/s]
Downloading [README.md]: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 16.8k/16.8k [00:00<00:00, 48.1kB/s]
Downloading [tokenizer_config.json]: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.15k/1.15k [00:00<00:00, 3.71kB/s]
Downloading [special_tokens_map.json]: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 964/964 [00:00<00:00, 1.98kB/s]
Downloading [sentencepiece.bpe.model]: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 4.83M/4.83M [00:07<00:00, 638kB/s]l
Downloading [tokenizer.json]: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 16.3M/16.3M [00:57<00:00, 299kB/s]
Downloading [model.safetensors]: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2.12G/2.12G [31:55<00:00, 1.19MB/s]
Processing 13 items: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 13.0/13.0 [31:55<00:00, 147s/it]