THUDM / ChatGLM-6B

ChatGLM-6B: An Open Bilingual Dialogue Language Model | 开源双语对话语言模型
Apache License 2.0
39.94k stars 5.15k forks source link

[BUG/Help] System Prompt Fixed in ChatGLM? #499

Open Soul-AI-LLM opened 1 year ago

Soul-AI-LLM commented 1 year ago

Is there an existing issue for this?

Current Behavior

When typing in English: User: Hello, who are you? ChatGLM-6B: Hello! As an AI language model, I don't have a personal identity like humans do. I'm just a tool designed to assist you in generating text based on your inputs. Please feel free to ask me any questions or give me any commands to help you out.

When typing in Chinese, it looks like it always shows the system prompt information, which is different from English User: 你好!你是谁? ChatGLM-6B: 你好,我是一个名为 ChatGLM-6B 的人工智能助手,是基于清华大学 KEG 实验室和智谱 AI 公司于 2023 年共同训练的语言模型开发的。我的任务是针对用户的问题和要求提供适当的答复和支持。

Also when try to assign new role to ChatGLM-6B in Chinese, it always comes back to its orignal role: User: 作为孔子和我聊天。 ChatGLM-6B:好的,非常愿意和您聊天。请问有什么话题或问题想和我聊吗? User:你是谁? ChatGLM-6B:我是 ChatGLM-6B,一个由清华大学 KEG 实验室和智谱 AI 公司于 2023 年共同训练的语言模型。

Expected Behavior

I would expect to change the system prompt and can assign the different roles to ChatGLM-6B, similar as ChatGPT. Is there a way to input system prompt to ChatGLM-6B or change role from orginal role there?

Steps To Reproduce

from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True) model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).half().cuda() model = model.eval() response, history = model.chat(tokenizer, "你好,你是谁?", history=[]) print(response) 你好,我是一个名为 ChatGLM-6B 的人工智能助手,是基于清华大学 KEG 实验室和智谱 AI 公司于 2023 年共同训练的语言模型开发的。我的任务是针对用户的问题和要求提供适当的答复和支持。

Environment

- OS: Linux
- Python: 3.8
- Transformers: 4.27.1
- PyTorch: 2.0.0+cu117
- CUDA Support (`python -c "import torch; print(torch.cuda.is_available())"`) : True

Anything else?

No response

hellopahe commented 10 months ago

Does chatGLM-v2 support SYSTEM message feature now?