QwenLM / Qwen

The official repo of Qwen (通义千问) chat & pretrained large language model proposed by Alibaba Cloud.
Apache License 2.0
12.47k stars 1.01k forks source link

[BUG] <title> wrong system prompt check? #1209

Closed XpastaX closed 2 months ago

XpastaX commented 2 months ago

是否已有关于该错误的issue或讨论? | Is there an existing issue / discussion for this?

该问题是否在FAQ中有解答? | Is there an existing answer for this in FAQ?

当前行为 | Current Behavior

for https://github.com/QwenLM/Qwen/blob/adb527133ea5abaf70b7183f57a68c256417ab36/finetune.py#L143 do you mean if roles[source[0]["from"]] != "user": I assume this step is to get rid of the custom-defined system prompt.

期望行为 | Expected Behavior

No response

复现方法 | Steps To Reproduce

No response

运行环境 | Environment

- OS:
- Python:
- Transformers:
- PyTorch:
- CUDA (`python -c 'import torch; print(torch.version.cuda)'`):

备注 | Anything else?

No response

jklj077 commented 2 months ago

This piece of code has become somewhat confusing after cleanup, but it is correct.

roles = {"user": "<|im_start|>user", "assistant": "<|im_start|>assistant"}

...

for i, source in enumerate(sources):
    if roles[source[0]["from"]] != roles["user"]:

In those roles settings, it is the same with checking if source[0]["from"] == "user".

XpastaX commented 2 months ago

Thank you for the response!