---
title: Janus-Pro-1B-OrangePi-模型库-ModelZoo-昇腾社区
description: Janus-Pro是 DeepSeek 推出的开源AI模型，支持图像理解和图像生成，适配多元应用场景。 本模型支持OrangePi AiPro（20T/24GDDR）开发板。
keywords: Janus,Pro,OrangePi,模型库,ModelZoo,昇腾社区,版本配套,准备运行环境
url: https://www.hiascend.com/software/modelzoo/models/detail/ac7a2ef7bff640f2a7a02a2d3b0380cd
section: (其他)
---

# Janus-Pro-1B-OrangePi-模型库-ModelZoo-昇腾社区

URL: https://www.hiascend.com/software/modelzoo/models/detail/ac7a2ef7bff640f2a7a02a2d3b0380cd
描述: Janus-Pro是 DeepSeek 推出的开源AI模型，支持图像理解和图像生成，适配多元应用场景。 本模型支持OrangePi AiPro（20T/24GDDR）开发板。
关键词: Janus,Pro,OrangePi,模型库,ModelZoo,昇腾社区,版本配套,准备运行环境

ModelZoo主页

主页 [了解详情](https://www.hiascend.com/software/modelzoo)大模型 [了解详情](https://www.hiascend.com/software/modelzoo/big-models)模型库 [了解详情](https://www.hiascend.com/software/modelzoo/models)工具库 [了解详情](https://www.hiascend.com/software/modelzoo/tools)权重库 [了解详情](https://www.hiascend.com/software/modelzoo/datasets)ModelShow [了解详情](https://www.hiascend.com/software/modelzoo/modelshow)DeepSeek专区HOT [了解详情](https://www.hiascend.com/developer/deepseek)文档中心 [了解详情](https://www.hiascend.com/document/detail/zh/ModelZoo/Documentation/overview/overview_0001.html)论坛交流 [了解详情](https://www.hiascend.com/forum/forum-0140120119986591009-1.html)

主页 [了解详情](https://www.hiascend.com/software/modelzoo)大模型 [了解详情](https://www.hiascend.com/software/modelzoo/big-models)模型库 [了解详情](https://www.hiascend.com/software/modelzoo/models)工具库 [了解详情](https://www.hiascend.com/software/modelzoo/tools)权重库 [了解详情](https://www.hiascend.com/software/modelzoo/datasets)ModelShow [了解详情](https://www.hiascend.com/software/modelzoo/modelshow)DeepSeek专区HOT [了解详情](https://www.hiascend.com/developer/deepseek)文档中心 [了解详情](https://www.hiascend.com/document/detail/zh/ModelZoo/Documentation/overview/overview_0001.html)论坛交流 [了解详情](https://www.hiascend.com/forum/forum-0140120119986591009-1.html)

模型库 [了解详情](https://www.hiascend.com/software/modelzoo/models)

Janus-Pro-1B-OrangePi

## Janus-Pro-1B-OrangePi

图文多模态PyTorch推理586次浏览2026/01/19更新

获取源码

Janus-Pro-1B-OrangePi

查看模型源码

模型使用

版本信息

模型使用

版本信息

...

# Janus-Pro-1B-OrangePi

## 版本配套

| 组件 | 版本 |
| --- | ---|
| MindIE | 1.0.0 |
| CANN | 8.0.0 |
| PTA | 6.0.0 |
| MindStudio | 7.0.0 |
| HDK | 24.1.0 |
| python | 3.10 |

## 一、准备运行环境

### 1.1 获取CANN&MindIE安装包&环境准备

- 设备支持
OrangePi AiPro 20T/24G
- 环境准备环境准备指导 [了解详情](https://www.hiascend.com/document/detail/zh/CANNCommunityEdition/80RC2alpha002/softwareinst/instg/instg_0001.html)
- 安装包下载PyTorch下载链接 [了解详情](https://www.hiascend.com/developer/download/community/result?module=pt+ie+cann)请下载`Ascend Extension for PyTorch - 6.0.0.beta1-PyTorch2.1.0`中的` torch_npu-2.1.0.post10-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl`
- CANN-toolkit下载链接 [了解详情](https://mindie.obs.cn-north-4.myhuaweicloud.com/xiangchengpai_20250211/Ascend-cann-toolkit_8.1.RC1_linux-aarch64.run)
- CANN-kernels下载链接 [了解详情](https://mindie.obs.cn-north-4.myhuaweicloud.com/xiangchengpai_20250211/Ascend-cann-kernels-310b_8.1.RC1_linux-aarch64.run)
- 代码下载

`git clone https://modelers.cn/MindIE/Janus-Pro-1B-OrangePi.git`

### 1.2 CANN安装

```
# 增加软件包可执行权限
chmod +x ./Ascend-cann-toolkit_8.1.RC1_linux-aarch64.run
chmod +x ./Ascend-cann-kernels-310b_8.1.RC1_linux-aarch64.run
# 校验软件包安装文件的一致性和完整性
./Ascend-cann-toolkit_8.1.RC1_linux-aarch64.run --check
./Ascend-cann-kernels-310b_8.1.RC1_linux-aarch64.run --check
# 安装
./Ascend-cann-toolkit_8.1.RC1_linux-aarch64.run  --install --force
./Ascend-cann-kernels-310b_8.1.RC1_linux-aarch64.run --install
# 设置环境变量
source /usr/local/Ascend/ascend-toolkit/set_env.sh
```

### 1.3 Torch_npu和相关依赖安装

```
pip install -r requirements.txt
pip install torch_npu-2.1.0.post10-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
```

替换transformers中的utils.py

```
transformers_path=$(pip3 show transformers|grep Location|awk '{print $2}')
# 修改${transformers_path}/transformers/generation/utils.py中的函数
# 将第2487行修改为
model_kwargs["cache_position"] = torch.arange(cur_len, device="cpu").npu()
```

替换transformers中的modeling_llama.py

```
transformers_path=$(pip3 show transformers|grep Location|awk '{print $2}')
# 修改${transformers_path}/transformers/models/llama/modeling_llama.py中的函数
# 将第141行修改为
freqs = (inv_freq_expanded.to(torch.float16) @ position_ids_expanded.to(torch.float16)).transpose(1, 2)
# 将第985~987行修改为
cache_position = torch.arange(
    past_seen_tokens, past_seen_tokens + inputs_embeds.shape[1], device="cpu"
).npu()
# 将第1096行修改为
causal_mask *= torch.arange(target_length, device="cpu").npu() > cache_position.reshape(-1, 1)
```

替换timm中的mlp.py

```
timm_path=$(pip3 show timm|grep Location|awk '{print $2}')
# 修改${timm_path}/mlp/layers/mlp.py中的函数
# 将第45行修改为
x = self.act(x.cpu()).npu()
```

## 二、执行推理

### 2.1 下载权重

- Janus-Pro-1B [了解详情](https://modelers.cn/models/State_Cloud/Janus-Pro-1B)

### 2.2 下载模型依赖

```
pip install -e .
```

### 2.3 执行推理脚本

#### 2.3.1 多模态理解

```
python inference.py --path './deepseek-ai/Janus-Pro' --device_id 0 --type fp16
```

#### 2.3.2 多模态生成

```
python generation_inference.py --path './deepseek-ai/Janus-Pro' --device_id 0 --type fp16
```

#### 2.3.3 命令行参数说明

```
--device_id 指定npu运行设备
--type 运行的数据类型，设备只支持fp16
--path 指定模型路径
```

| 版本 | 更新时间 | 精度 | 处理器 | CANN版本 | 操作 |
| --- | --- | --- | --- | --- | ---|
| 1.0 | 2025/02/12 | FP16 | Ascend 310 | CANN 8.0.0 | MindIE |

使用模型资源和服务前，请您仔细阅读并理解透彻《昇腾深度学习模型许可协议 3.0》 [了解详情](https://www.hiascend.com/legal/modelzoo_models_license)
