Comments (2)
There are actually two kinds of tokenization strategies. For base models (pretrained without SFT) like Baichuan2-7B, it's fine to directly encode the text into token ids without adding any special prefix or suffix tokens, just as your tokenizer('你好吗', return_tensors='pt')
. However, for chat models (after SFT) like Baichuan2-7B-Chat, they are usually trained on a specific prompt template during SFT. When they're deployed for inference, their prompt patterns should be respected. In this case, Baichuan2-7B-Chat uses a prompt template like: (see https://huggingface.co/baichuan-inc/Baichuan2-7B-Chat/blob/main/generation_utils.py#L30-L43)
<user_token_id>prompt1<assistant_token_id>response1<user_token_id>prompt2<assistant_token_id>response2 ...
where <user_token_id>
is 195 and <assistant_token_id>
is 196 according to their generation config (see https://huggingface.co/baichuan-inc/Baichuan2-7B-Chat/blob/main/generation_config.json#L5-L6). We should add these special tokens to make it chat normally.
from chatglm.cpp.
Thanks for your reply. I closed this issue.
from chatglm.cpp.
Related Issues (20)
- ChatGLM3 使用 examples/cli_demo.py 时报错 'TypeError: chat() got an unexpected keyword argument 'max_new_tokens'' HOT 1
- check failed (data != MAP_FAILED) Invalid argument HOT 1
- How to construct a ToolCallMessage?
- 更新后运行报错:No module named 'pydantic._internal' HOT 4
- 【已解决,附解决方法】无法运行 LangChain API ,执行命令后报错, 能否提供能成功运行此命令的 python版本号 和 使用的环境中安装的包的列表 HOT 3
- 显存使用增加
- 为什么4090显卡用不了,编译成功之后也是用的cpu推理 HOT 5
- mac m1 启动cli_demo.py时,抛出incompatible architecture异常 HOT 1
- 如何设置更长的上下文(context) HOT 5
- v0.3.0 "发布" 里的Python包中的C++程序是以什么配置构建的?
- Fix: Dockerfile Building Locally
- 量化后的ChatGlm3-6B使用open_api部署tools功能无法使用 HOT 1
- -DGGML_CUBLAS=ON,编译成功之后无法使用显卡进行推理,仍然使用CPU进行推理 HOT 4
- Long context result (>450 tokens) from server will stop / return incorrect json (stream mode)
- openai_api 返回为空 HOT 1
- 能否在开启openai api时候提供一个public link? HOT 1
- Run the following command to report an error python3 chatglm3_demo.py -m ../chatglm3-ggml.bin -p 你好 --temp 0.8 --top_p 0.8
- zsh: illegal hardware instruction HOT 1
- 请问下这个报错是什么原因造成的? HOT 1
- 【feature request】关于Tool/func调用,有没有方式支持多次自动调用(更长的思维链)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chatglm.cpp.