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
VisualGLM-6B_pytorch
Commits
3a6a0c72
Commit
3a6a0c72
authored
Jan 22, 2024
by
wangsen
Browse files
Update README.md
parent
d03b4039
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
10 deletions
+2
-10
README.md
README.md
+2
-10
No files found.
README.md
View file @
3a6a0c72
...
@@ -29,17 +29,8 @@ docker run -it -v /path/your_data/:/path/your_data/ --shm-size=32G --privileged=
...
@@ -29,17 +29,8 @@ docker run -it -v /path/your_data/:/path/your_data/ --shm-size=32G --privileged=
```
```
## 推理
## 推理
使用pip安装依赖
```
pip install -i https://mirrors.aliyun.com/pypi/simple/ -r requirements.txt
```
此时默认会安装deepspeed库(支持sat库训练),此库对于模型推理并非必要,同时部分Windows环境安装此库时会遇到问题。 如果想绕过deepspeed安装,我们可以将命令改为
```
pip install -i https://mirrors.aliyun.com/pypi/simple/ -r requirements_wo_ds.txt
pip install -i https://mirrors.aliyun.com/pypi/simple/ --no-deps "SwissArmyTransformer>=0.4.4"
```
使用Huggingface transformers库调用模型,可以通过如下代码(其中图像路径为本地路径,模型路径为THUDM/visulglm-6b):
使用Huggingface transformers库调用模型,
通过下面地址下载模型https://huggingface.co/THUDM/visualglm-6b/tree/main,
可以通过如下代码(其中图像路径为本地路径,模型路径为THUDM/visulglm-6b):
```
```
from
transformers
import
AutoTokenizer
,
AutoModel
from
transformers
import
AutoTokenizer
,
AutoModel
tokenizer
=
AutoTokenizer
.
from_pretrained
(
"THUDM/visualglm-6b"
,
trust_remote_code
=
True
)
tokenizer
=
AutoTokenizer
.
from_pretrained
(
"THUDM/visualglm-6b"
,
trust_remote_code
=
True
)
...
@@ -58,6 +49,7 @@ Specify both input_ids and inputs_embeds at the same time, will use inputs_embed
...
@@ -58,6 +49,7 @@ Specify both input_ids and inputs_embeds at the same time, will use inputs_embed
```
```
命令行 Demo
命令行 Demo
```
```
cd /home/VisualGLM-6B
python cli_demo_hf.py
python cli_demo_hf.py
```
```
程序会自动下载sat模型,并在命令行中进行交互式的对话,输入指示并回车即可生成回复,输入 clear 可以清空对话历史,输入 stop 终止程序。
程序会自动下载sat模型,并在命令行中进行交互式的对话,输入指示并回车即可生成回复,输入 clear 可以清空对话历史,输入 stop 终止程序。
...
...
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