Skip to content

Commit 48cc08c

Browse files
authored
Merge pull request #733 from luyao-cv/develop
add env_run.sh and correct packages version
2 parents 998ba83 + ae7f9da commit 48cc08c

File tree

11 files changed

+144
-33
lines changed

11 files changed

+144
-33
lines changed

README.md

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,30 +48,46 @@ PaddleMIX是基于飞桨的多模态大模型开发套件,聚合图像、文
4848
https://github.com/PaddlePaddle/PaddleMIX/assets/29787866/8d32722a-e307-46cb-a8c0-be8acd93d2c8
4949

5050

51-
## 安装
51+
## 安装步骤
52+
### 1. 克隆PaddleMIX仓库
53+
```
54+
git clone https://github.com/PaddlePaddle/PaddleMIX
55+
cd PaddleMIX
56+
```
5257

53-
1. 环境依赖
58+
### 2. 创建虚拟环境
59+
```
60+
conda create -n paddlemix python=3.10 -y
61+
conda activate paddlemix
5462
```
55-
pip install -r requirements.txt
63+
### 3. 安装PaddlePaddle
64+
#### 方法 1: 一键安装(推荐)
65+
- CUDA 11.x或12.3
66+
- PaddlePaddle 3.0.0b1
67+
```
68+
sh build_paddle_env.sh
5669
```
5770

71+
#### 方法 2: 手动安装
5872
关于PaddlePaddle安装的详细教程请查看[Installation](https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/develop/install/pip/linux-pip.html)
5973

60-
> 注:ppdiffusers部分模型需要依赖 CUDA 11.2 及以上版本,如果本地机器不符合要求,建议前往 [AI Studio](https://aistudio.baidu.com/index) 进行模型训练、推理任务。
6174

62-
> 如果希望使用**bf16**训练推理,请使用支持**bf16**的GPU,如A100。
75+
### 4. 安装依赖
6376

64-
2. 手动安装
65-
```
66-
git clone https://github.com/PaddlePaddle/PaddleMIX
67-
cd PaddleMIX
68-
pip install -e .
77+
#### 方法 1: 一键安装(推荐)
6978

70-
#ppdiffusers 安装
71-
cd ppdiffusers
72-
pip install -e .
79+
运行以下命令来自动安装所有必要的依赖:
80+
```
81+
sh build_env.sh
7382
```
7483

84+
#### 方法 2: 手动安装(请参考 build_env.sh)
85+
86+
> 注:ppdiffusers部分模型需要依赖 CUDA 11.2 及以上版本,如果本地机器不符合要求,建议前往 [AI Studio](https://aistudio.baidu.com/index) 进行模型训练、推理任务。
87+
88+
> 如果希望使用**bf16**训练推理,请使用支持**bf16**的GPU,如A100。
89+
90+
7591
## 教程
7692

7793
- [快速开始](applications/README.md/#快速开始)

README_EN.md

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,29 +47,47 @@ https://github.com/PaddlePaddle/PaddleMIX/assets/29787866/8d32722a-e307-46cb-a8c
4747

4848

4949

50-
## Installation
50+
## Installation
51+
### 1. Clone the PaddleMIX repository
52+
```
53+
git clone https://github.com/PaddlePaddle/PaddleMIX
54+
cd PaddleMIX
55+
```
5156

52-
1. Environment Dependencies
57+
### 2. Create a virtual environment
58+
```
59+
conda create -n paddlemix python=3.10 -y
60+
conda activate paddlemix
5361
```
54-
pip install -r requirements.txt
62+
### 3. Install PaddlePaddle
63+
#### Method 1: One-click installation (recommended)
64+
- CUDA 11.x or 12.3
65+
- PaddlePaddle 3.0.0b1
5566
```
67+
sh build_paddle_env.sh
68+
```
69+
70+
#### Method 2: Manual installation
71+
For detailed instructions on installing PaddlePaddle, please refer to [Installation](https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/develop/install/pip/linux-pip.html).
72+
73+
74+
### 4. Install dependencies
75+
76+
#### Method 1: One-click installation (recommended)
77+
78+
Run the following command to automatically install all necessary dependencies:
79+
```
80+
sh build_env.sh
81+
```
82+
83+
#### Method 2: Manual installation (Please refer to build_env.sh)
5684

5785
Detailed [installation]((https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/develop/install/pip/linux-pip.html)) tutorials for PaddlePaddle
5886

5987
> Note: parts of Some models in ppdiffusers require CUDA 11.2 or higher. If your local machine does not meet the requirements, it is recommended to go to [AI Studio](https://aistudio.baidu.com/index) for model training and inference tasks.
6088
6189
> If you wish to train and infer using **bf16**, please use a GPU that supports **bf16**, such as the A100.
6290
63-
2. Manual Installation
64-
```
65-
git clone https://github.com/PaddlePaddle/PaddleMIX
66-
cd PaddleMIX
67-
pip install -e .
68-
69-
#ppdiffusers 安装
70-
cd ppdiffusers
71-
pip install -e .
72-
```
7391

7492
## Tutorial
7593

build_env.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
# 设置错误时退出
4+
set -e
5+
6+
echo "开始安装 PaddleMIX 及其依赖..."
7+
8+
# 安装 PaddleMIX
9+
echo "安装 PaddleMIX..."
10+
pip install -e .
11+
12+
# 安装 ppdiffusers
13+
echo "安装 ppdiffusers..."
14+
cd ppdiffusers
15+
pip install -e .
16+
cd ..
17+
18+
# 安装依赖包
19+
echo "安装依赖包..."
20+
pip install -r requirements.txt
21+
22+
# 安装自定义算子
23+
echo "安装自定义算子..."
24+
cd paddlemix/external_ops
25+
python setup.py install
26+
cd ../../
27+
28+
echo "安装完成!"

build_paddle_env.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
# 设置错误时退出
4+
set -e
5+
6+
echo "开始安装 paddlepaddle ..."
7+
# 检测 CUDA 版本并安装相应的 paddlepaddle
8+
if command -v nvcc &> /dev/null; then
9+
cuda_version=$(nvcc --version | grep "release" | sed -n 's/.*release \([0-9]\+\.[0-9]\+\).*/\1/p')
10+
echo "检测到 CUDA 版本: $cuda_version"
11+
if [[ "$cuda_version" == "11.2" ]]; then
12+
echo "安装 CUDA 11.2 版本的 paddlepaddle..."
13+
python -m pip install paddlepaddle-gpu==3.0.0b1 -i https://www.paddlepaddle.org.cn/packages/stable/cu112/
14+
elif [[ "$cuda_version" == "11.6" ]]; then
15+
echo "安装 CUDA 11.6 版本的 paddlepaddle..."
16+
python -m pip install paddlepaddle-gpu==3.0.0b1 -i https://www.paddlepaddle.org.cn/packages/stable/cu116/
17+
elif [[ "$cuda_version" == "11.7" ]]; then
18+
echo "安装 CUDA 11.7 版本的 paddlepaddle..."
19+
python -m pip install paddlepaddle-gpu==3.0.0b1 -i https://www.paddlepaddle.org.cn/packages/stable/cu117/
20+
elif [[ "$cuda_version" == "11.8" ]]; then
21+
echo "安装 CUDA 11.8 版本的 paddlepaddle..."
22+
python -m pip install paddlepaddle-gpu==3.0.0b1 -i https://www.paddlepaddle.org.cn/packages/stable/cu118/
23+
elif [[ "$cuda_version" == "12.3" ]]; then
24+
echo "安装 CUDA 12.3 版本的 paddlepaddle..."
25+
python -m pip install paddlepaddle-gpu==3.0.0b1 -i https://www.paddlepaddle.org.cn/packages/stable/cu123/
26+
else
27+
echo "警告: 不支持的 CUDA 版本。请手动安装适合您系统的 paddlepaddle 版本。"
28+
fi
29+
else
30+
echo "未检测到 CUDA。安装 CPU 版本的 paddlepaddle..."
31+
pip install paddlepaddle-gpu==3.0.0b1
32+
fi
33+
34+
echo "安装完成!"

paddlemix/appflow/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ paddlenlp>=2.6.0rc0
44
https://bj.bcebos.com/v1/paddlenlp/models/community/paddlemix/appflow/paddlespeech/paddlespeech-0.0.1-py3-none-any.whl
55
opencc==1.1.6
66
matplotlib==3.7.5
7+
scipy==1.12.0

paddlemix/datasets/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
if version.startswith('3'):
3232
from .internvl_dataset import *
3333
else:
34-
print(f"paddlenlp version {version} is not 3.x, skipping import.")
34+
print(f"paddlenlp version {version} is not 3.x, skipping import internvl2 datasets.")
3535

3636
except ImportError:
3737
print("paddlenlp is not installed.")

paddlemix/examples/qwen2_vl/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@
1010
- **python >= 3.10**
1111
- tiktoken
1212
> 注:tiktoken 要求python >= 3.8
13-
- paddlepaddle-gpu >= 2.6.1
13+
- **paddlepaddle-gpu 要求版本develop**
14+
```
15+
# 安装示例
16+
python -m pip install paddlepaddle-gpu==0.0.0.post118 -f https://www.paddlepaddle.org.cn/whl/linux/gpu/develop.html
17+
```
18+
19+
1420
- paddlenlp >= 3.0.0(默认开启flash_attn,推荐源码编译安装)
1521

1622
> 注:

paddlemix/models/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from .minigpt4.modeling import *
2727
from .visualglm.configuration import *
2828
from .visualglm.modeling import *
29+
from .qwen_vl import *
2930

3031

3132
import pkg_resources
@@ -34,9 +35,10 @@
3435
try:
3536
if version.startswith('3'):
3637
from .internvl2 import *
37-
from .qwen_vl import *
38+
from .qwen2_vl import *
39+
3840
else:
39-
print(f"paddlenlp version {version} is not 3.x, skipping import.")
41+
print(f"paddlenlp version {version} is not 3.x, skipping import internvl2 and qwen2_vl.")
4042

4143
except ImportError:
4244
print("paddlenlp is not installed.")

paddlemix/models/llava/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
from .modeling_qwen import *
2929
from .configuration_qwen import *
3030
else:
31-
print(f"paddlenlp version {version} is not 3.x, skipping import.")
31+
print(f"paddlenlp version {version} is not 3.x, skipping import Qwen2Model for llava-next.")
3232

3333
except ImportError:
3434
print("paddlenlp is not installed.")

ppdiffusers/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ git clone https://github.com/PaddlePaddle/PaddleMIX
8888
cd PaddleMIX/ppdiffusers
8989
python setup.py install
9090
```
91+
### 设置代理
92+
```shell
93+
export HF_HUB_ENABLE_HF_TRANSFER=1
94+
export HF_ENDPOINT=https://hf-mirror.com
95+
```
9196

9297
## 快速开始
9398
我们将以扩散模型的典型代表**Stable Diffusion**为例,带你快速了解PPDiffusers。

ppdiffusers/requirements.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
paddlenlp==2.7.2
1+
paddlenlp>=2.7.2
22
safetensors>=0.3.1
33
ftfy
44
regex
@@ -14,4 +14,5 @@ urllib3<=2.0.0
1414
einops>=0.6.1
1515
paddlesde
1616
ligo-segments
17-
huggingface_hub==0.23
17+
huggingface_hub>=0.22.0
18+
hf_transfer

0 commit comments

Comments
 (0)