chatglm3 error: why are there multiple <|assistant|> <|user|> tags in the generated datas?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 39.5k
- Forks
- 4.8k
- PR merge metrics
- No merged PRs in 30d
Description
How to write the format of api request payload and stop, the generated data results are not correct?
deploy model:
python -m fastchat.serve.model_worker --model-path chatglm3-6b
code:
```
headers = {"Content-Type": "application/json"}
pload = {
"model": "chatglm3-6b",
"prompt": "<|user|>\n 介绍下广州<|assistant|>",
# "stop": [
# 64795,
# 64797,
# 2,
# ],
# "stop":["<|user|>", "<|observation|>", "","<|assistant|>"],
"stop":"###",
"max_new_tokens": 512,
}
response = requests.post("http://19***1:21002/worker_generate_stream", headers=headers, json=pload, stream=True,timeout=3)
# print(response.text)
for chunk in response.iter_lines(chunk_size=1024,decode_unicode=False, delimiter=b"\0"):
if chunk:
# print(chunk.decode("utf-8"))
data = json.loads(chunk.decode("utf-8"))
print(data["text"])
```

```
[gMASK]sop <|user|>
介绍下广州<|assistant|> 广州,简称“粤”,省会、副省级市,是广东省会,地处中国南部、广东省中部、珠江三角洲北部。全市总面积11,396平方千米,人口约为1530万(截至2021年底)。广州自古以来就是商业和文化的中心,被称为“羊城”,因 historical landmarks such as the Forbidden City and Lenin Memorial Hall.广州还是一些 large-scale shopping centers such as the Chengdu Road, and is famous for its delicious cuisine, including dim sum, roasted goose, and other traditional dishes.
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Python model worker launched by `python -m fastchat.serve.model_worker` and inspect handling of `/worker_generate_stream`, the prompt, and the `stop` payload field. Reproduce the ChatGLM3 request and determine the expected stopping behavior; done means the response stops at the intended boundary without repeated `<|assistant|>` or `<|user|>` tags.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ai, api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100