cenos 7.9 安装 modelscope 及下载模型文件

一 环境信息

1.1 软件信息

序号 名称 版本
1 操作系统 CentOS Linux release 7.9.2009 (Core)

二 安装

因为centos7.9 默认是python2.7 ,而modelscope 需要python 3.8,所以需要先安装conda,然后安装python3\pip,最后安装modelscope

2.1 安装conda

2.1.1 系统环境准备

2.1.1.1 安装基础依赖

[root@2023001 ~]# yum install -y bzip2 wget gcc openssl-devel

2.1.1.2 安装开发工具链

[root@2023001 ~]# yum groupinstall "Development Tools" -y

2.1.2 安装 MiniConda

2.1.2.1 下载Minconda 安装脚本

[root@2023001 conda]# wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

2.1.2.2 运行安装脚本

# 执行安装
bash Miniconda3-latest-Linux-x86_64.sh

# 安装过程需交互操作:
# 1. 按回车阅读协议
# 2. 输入 yes 同意协议
# 3. 设置安装路径(默认:/root/miniconda3)
# 4. 输入 yes 初始化 conda

2.1.2.3 激活Conda 环境

[root@2023001 conda]# source ~/.bashrc 
(base) [root@2023001 conda]# conda --version
conda 25.3.1
(base) [root@2023001 conda]# 

2.1.3 安装 ModelScope

2.1.3.1 安装核心库

(base) [root@2023001 conda]# pip install modelscope
(base) [root@2023001 conda]# modelscope -h
usage: modelscope <command> [<args>]

positional arguments:
  {download,upload,clear-cache,plugin,pipeline,modelcard,model,server,login,llamafile}
                        modelscope commands helpers

options:
  -h, --help            show this help message and exit
  --token TOKEN         Specify ModelScope SDK token.
(base) [root@2023001 conda]#

2.1.3.2 修改modelScope 默认下载路径

模型文件较大时,建议修改默认下载路径

(base) [root@2023001 modelscope]# cp ~/.bashrc ~/.bashrc.bak.20250515
(base) [root@2023001 modelscope]# echo 'export MODELSCOPE_CACHE="/data/soft/modelscope"' >> ~/.bashrc
(base) [root@2023001 modelscope]# source ~/.bashrc

2.1.3.3 后台下载模型文件

nohup modelscope download --model Qwen/Qwen2.5-Coder-32B-Instruct > qwen.log 2>&1 &

posted on 2025-05-15 17:34  weiwei2021  阅读(264)  评论(0)    收藏  举报