THUDM / ChatGLM2-6B

ChatGLM2-6B: An Open Bilingual Chat LLM | 开源双语对话语言模型
Other
15.65k stars 1.85k forks source link

[Help] chatglm2是否有类似openai中stop的接口 #637

Open dbtzy opened 7 months ago

dbtzy commented 7 months ago

Is there an existing issue for this?

Current Behavior

chatglm2是否有类似openai中stop的接口?

Expected Behavior

No response

Steps To Reproduce

我希望实现chatglm2在生成答案时如果生成的字符满足stop中的字符就停止生成。

假设没有设置stop,模型回答SQLQuery: SELECT COUNT(*) FROM Customer\nSQLResult: 3,在设置stop=["\nSQLResult:"]后,模型只输出SQLQuery: SELECT COUNT(*) FROM Customer

是否存在这样的接口?

Environment

- OS: Ubuntu 22.04
- Python: 3.10.13
- Transformers: 4.35.2
- PyTorch: 2.1.0
- CUDA Support (`python -c "import torch; print(torch.cuda.is_available())"`) : True

Anything else?

No response