HuggingFace镜像/GLM-4.1V-9B-Thinking
模型介绍文件和版本分析
下载使用量0

环境要求

mindspore 2.5.0/2.6.0 ascend driver 24.1.RC3.b080 firmware 7.5.T11.0.B088 cann tookit/kernel 8.0.RC3.beta1

权重下载

下载权重到/home/GLM-4.1V,需要预留至少21GB空间,可以根据需要调整路径

pip install openmind_hub
export HUB_WHITE_LIST_PATHS=/home/GLM-4.1V
python
from openmind_hub import snapshot_download
snapshot_download(
    repo_id="MindSpore-Lab/GLM-4.1V-9B-Thinking",
    local_dir="/home/GLM-4.1V",
    local_dir_use_symlinks=False
)

环境准备

安装最新的mindone以及transformers,/home路径根据需要调整。

cd /home
git clone https://github.com/mindspore-lab/mindone.git --depth 1

若执行失败,可以尝试:

git clone https://gh-proxy.com/github.com/mindspore-lab/mindone.git --depth 1

之后执行

cd mindone
pip install -e .

安装transformers(安装过程中忽略报错信息)

pip install transformers==4.53.0

执行推理测试

参数model_name指的是本地下载的权重,根据需要调整。image指的是本地存储的图片,需要更改。 默认推理token数是128,如果需要更多可以修改/home/mindone/examples/transformers/glm4v/generate.py中的max_new_tokens=128改成2048。

若想要输出英文,则输入英文(推荐)

cd /home/mindone/examples/transformers/glm4v
python generate.py --model_name /home/GLM-4.1V --image /home/trial.jpg --prompt "Describe this image."

若想要输出中文,则输入中文

cd /home/mindone/examples/transformers/glm4v
python generate.py --model_name /home/GLM-4.1V --image /home/trial.jpg --prompt "请帮我描述这张图片"