文件最后提交记录最后更新时间
[Docs] modify the branch version Co-authored-by: js1234567<jiangshuo9@h-partners.com> # message auto-generated for no-merge-commit merge: !1640 merge 2.2.0 into 2.2.0 [Docs] modify the branch version Created-by: js1234567 Commit-by: js1234567 Merged-by: ascend-robot Description: ## Motivation Modify the branch version for branch 2.2.0 ## Modification Delete Apex installation Modify the git clone from master to 2.2.0 ## Self-test (Optional) If modifications to this PR may cause/fix function/accuracy/performance DTSs/issues, a self-inspection record needs to be attached. ## BC-breaking (Optional) If there are compatibility issues, such as dependencies on cann/torch_npu versions, they need to be explained in the PR. ## Checklist **Before PR**: - [x] The new code needs to comply with the Clean Code specification. - [x] The PR content is self-checked, and the expression can be clear and the writing standardized **After PR**: - [x] CLA has been signed and all committers have signed the CLA in this PR. - [x] The ci-pipeline is passed, Code Check is passed. See merge request: Ascend/MindSpeed-MM!16407 个月前
!1340 [Bugfix]Security update: Remove 'trust_remote_code : true' from example code. Merge pull request !1340 from zhangxubin/master 9 个月前
!1340 [Bugfix]Security update: Remove 'trust_remote_code : true' from example code. Merge pull request !1340 from zhangxubin/master 9 个月前
!1340 [Bugfix]Security update: Remove 'trust_remote_code : true' from example code. Merge pull request !1340 from zhangxubin/master 9 个月前
README.md

JanusPro 使用指南

环境安装

【模型开发时推荐使用配套的环境版本】

请参考安装指南

1. 仓库拉取

git clone --branch 2.2.0 https://gitcode.com/Ascend/MindSpeed-MM.git
git clone https://github.com/deepseek-ai/Janus.git
cd MindSpeed-MM
mkdir ckpt
cd ..

cp -r ./Janus ./MindSpeed-MM/examples/JanusPro

2. 环境搭建

对./examples/JanusPro/Janus中的pyproject.toml文件的dependencies做如下修改:

  • torch==2.7.1
  • numpy==1.26.4
  • 增加依赖:decorator
  • 增加依赖:scipy
  • 增加依赖:attrs
# python3.10
conda create -n test python=3.10
conda activate test

# 安装 torch 和 torch_npu,注意要选择对应python版本、x86或arm的torch及torch_npu包
# 下载路径参考 https://www.hiascend.com/document/detail/zh/Pytorch/60RC3/configandinstg/instg/insg_0001.html
pip install torch-2.7.1-cp310-cp310-manylinux_2_28_aarch64.whl
pip install torch_npu-2.7.1*-cp310-cp310-manylinux_2_28_aarch64.whl

# 安装JanusPro依赖库
cd MindSpeed-MM/examples/JanusPro/Janus
pip install -e .

cd ..

权重下载

1. 权重下载

从Huggingface库下载对应的模型权重:

将下载的模型权重保存到本地的ckpt/JanusPro-7B/目录下。

图像理解

1. 准备工作

配置脚本前需要完成前置准备工作,包括:环境安装权重下载,详情可查看对应章节。

2. 配置参数

在multimodal_understanding.sh中修改需要传入的参数,model_path, image_path与question,分别表示模型权重保存位置,图片位置与针对传入图片的问题。 同时还需要修改"trust_remote_code"为true。为保证代码安全,配置trust_remote_code默认为False,用户需要设置为True,并且确保自己下载的模型和数据的安全性。

另外还需设置CANN包安装位置。

    source /usr/local/Ascend/ascend-toolkit/set_env.sh

3. 启动脚本

  cd /examples/JanusPro/
  bash multimodal_understanding.sh

即可得到推理结果。

推理结果示例: 以examples/qwen2vl/demo.jpg为输入图片,question为“Describle this image”,得到的推理结果为:

  The image shows a person sitting on a sandy beach, interacting with a dog. 
  The person is wearing a checkered skirt and dark pants, and the dog, 
  which appears to be a Labrador Retriever, is sitting on its hind legs, 
  reaching out with its front paws towards the person. The sun is setting, 
  casting a warm glow over the screen.