Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
Gemma-2_pytorch
Commits
c18e84b2
Commit
c18e84b2
authored
Nov 06, 2024
by
chenych
Browse files
Update README
parent
3f85ca43
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
9 deletions
+1
-9
README.md
README.md
+1
-9
No files found.
README.md
View file @
c18e84b2
...
@@ -23,13 +23,11 @@ Gemma 2是由Google推出的一系列轻量级、最先进的开放模型,旨
...
@@ -23,13 +23,11 @@ Gemma 2是由Google推出的一系列轻量级、最先进的开放模型,旨
Gemma 2 Instruct 已针对对话应用进行了优化,并使用监督微调 (SFT)、大模型蒸馏、人类反馈强化学习 (RLHF) 和模型合并 (WARP) 来提高整体性能。
Gemma 2 Instruct 已针对对话应用进行了优化,并使用监督微调 (SFT)、大模型蒸馏、人类反馈强化学习 (RLHF) 和模型合并 (WARP) 来提高整体性能。
## 环境配置
## 环境配置
> Llama-Factory的安装方法请参考[README](https://developer.sourcefind.cn/codes/OpenDAS/llama-factory/-/blob/master/README.md)。
> Llama-Factory的安装方法请参考[README](https://developer.sourcefind.cn/codes/OpenDAS/llama-factory/-/blob/master/README.md)。
>
>
> -v 路径、docker_name和imageID根据实际情况修改。
> -v 路径、docker_name和imageID根据实际情况修改。
### Docker(方法一)
### Docker(方法一)
```
bash
```
bash
docker pull image.sourcefind.cn:5000/dcu/admin/base/pytorch:2.1.0-ubuntu20.04-dtk24.04.2-py3.10
docker pull image.sourcefind.cn:5000/dcu/admin/base/pytorch:2.1.0-ubuntu20.04-dtk24.04.2-py3.10
docker run
-it
-v
/path/your_code_data/:/path/your_code_data/
-v
/opt/hyhal/:/opt/hyhal/:ro
--shm-size
=
80G
--privileged
=
true
--device
=
/dev/kfd
--device
=
/dev/dri/
--group-add
video
--name
docker_name imageID bash
docker run
-it
-v
/path/your_code_data/:/path/your_code_data/
-v
/opt/hyhal/:/opt/hyhal/:ro
--shm-size
=
80G
--privileged
=
true
--device
=
/dev/kfd
--device
=
/dev/dri/
--group-add
video
--name
docker_name imageID bash
...
@@ -40,7 +38,6 @@ pip install -r requirements.txt
...
@@ -40,7 +38,6 @@ pip install -r requirements.txt
Tips:以上dtk驱动、python、torch、vllm等DCU相关工具版本需要严格一一对应。
Tips:以上dtk驱动、python、torch、vllm等DCU相关工具版本需要严格一一对应。
### Dockerfile(方法二)
### Dockerfile(方法二)
```
bash
```
bash
docker build
-t
gemma2:latest
.
docker build
-t
gemma2:latest
.
docker run
-it
-v
/path/your_code_data/:/path/your_code_data/
-v
/opt/hyhal/:/opt/hyhal/:ro
--shm-size
=
80G
--privileged
=
true
--device
=
/dev/kfd
--device
=
/dev/dri/
--group-add
video
--name
docker_name imageID bash
docker run
-it
-v
/path/your_code_data/:/path/your_code_data/
-v
/opt/hyhal/:/opt/hyhal/:ro
--shm-size
=
80G
--privileged
=
true
--device
=
/dev/kfd
--device
=
/dev/dri/
--group-add
video
--name
docker_name imageID bash
...
@@ -50,7 +47,6 @@ pip install -r requirements.txt
...
@@ -50,7 +47,6 @@ pip install -r requirements.txt
```
```
### Anaconda(方法三)
### Anaconda(方法三)
关于本项目DCU显卡所需的特殊深度学习库可从
[
光合
](
https://developer.hpccube.com/tool/
)
开发者社区下载安装。
关于本项目DCU显卡所需的特殊深度学习库可从
[
光合
](
https://developer.hpccube.com/tool/
)
开发者社区下载安装。
```
```
DTK驱动: dtk24.04.2
DTK驱动: dtk24.04.2
...
@@ -58,7 +54,6 @@ python: 3.10
...
@@ -58,7 +54,6 @@ python: 3.10
torch: 2.1.0
torch: 2.1.0
llama-factory: 0.8.3
llama-factory: 0.8.3
transformers: >=4.41.2
transformers: >=4.41.2
vllm: 0.5.4
```
```
`Tips:以上dtk驱动、python、torch等DCU相关工具版本需要严格一一对应`
`Tips:以上dtk驱动、python、torch等DCU相关工具版本需要严格一一对应`
...
@@ -81,7 +76,6 @@ pip uninstall flash_attn
...
@@ -81,7 +76,6 @@ pip uninstall flash_attn
```
```
### 单机单卡/单机多卡
### 单机单卡/单机多卡
1.
参考
`gemma-2_pytorch/llama-factory-v0.8.3/examples`
下
`train_full`
、
`train_lora`
中提供的gemma2样例,根据实际需求修改
`model_name_or_path`
、
`dataset`
、
`learning_rate`
、
`cutoff_len`
等参数,修改好的样例放入
`llama-factory`
框架的
`examples`
下的对应目录中即可。
1.
参考
`gemma-2_pytorch/llama-factory-v0.8.3/examples`
下
`train_full`
、
`train_lora`
中提供的gemma2样例,根据实际需求修改
`model_name_or_path`
、
`dataset`
、
`learning_rate`
、
`cutoff_len`
等参数,修改好的样例放入
`llama-factory`
框架的
`examples`
下的对应目录中即可。
```
bash
```
bash
# train_full 样例移动
# train_full 样例移动
...
@@ -101,10 +95,9 @@ HIP_VISIBLE_DEVICES=0,1 FORCE_TORCHRUN=1 llamafactory-cli train examples/train_l
...
@@ -101,10 +95,9 @@ HIP_VISIBLE_DEVICES=0,1 FORCE_TORCHRUN=1 llamafactory-cli train examples/train_l
```
```
## 推理
## 推理
使用
`transformers`
框架推理
,vllm版本需>0.5.0
。
使用
`transformers`
框架推理。
### 单机单卡
### 单机单卡
```
bash
```
bash
# 指定卡号
# 指定卡号
export
HIP_VISIBLE_DEVICES
=
0,1
export
HIP_VISIBLE_DEVICES
=
0,1
...
@@ -141,7 +134,6 @@ python inference.py --model_path /path/of/gemma2 --max_new_tokens xxx
...
@@ -141,7 +134,6 @@ python inference.py --model_path /path/of/gemma2 --max_new_tokens xxx
`科研,教育,政府,金融`
`科研,教育,政府,金融`
## 预训练权重
## 预训练权重
[
gemma-2-2b
](
http://113.200.138.88:18080/aimodels/gemma-2-2b
)
[
gemma-2-2b
](
http://113.200.138.88:18080/aimodels/gemma-2-2b
)
[
gemma-2-2b-it
](
http://113.200.138.88:18080/aimodels/gemma-2-2b-it
)
[
gemma-2-2b-it
](
http://113.200.138.88:18080/aimodels/gemma-2-2b-it
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment