Commit 3a6a0c72 authored by wangsen's avatar wangsen
Browse files

Update README.md

parent d03b4039
...@@ -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 终止程序。
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment