Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: not generate eos_token when using qwen7B-chat #924

Open
qiufengyuyi opened this issue Feb 29, 2024 · 0 comments
Open

bug: not generate eos_token when using qwen7B-chat #924

qiufengyuyi opened this issue Feb 29, 2024 · 0 comments

Comments

@qiufengyuyi
Copy link

Describe the bug

when using qwen-7b-chat,and openai completion api ,i have given stop tokens like ["<|im_end|>","<|endoftext|>"],but it always stop when reach the max length limit.i have check the generation ,and find it doesn't generate eos token. so the generation contains many unexpected contents

To reproduce

import openai

client = openai.OpenAI(
base_url='http://localhost:3000/v1', api_key='na'
) # Here the server is running on localhost:3000

models = client.models.list()
print('Models:', models.model_dump_json(indent=2))
model = models.data[0].id
completions = client.completions.create(
prompt='<|im_start|>system\n{system_message}<|im_end|>\n<|im_start|>user\n介绍一下南京<|im_end|>\n<|im_start|>assistant\n', model=model, max_tokens=512, stream=False,stop=["<|im_end|>","<|endoftext|>"]
)

print(completions)

Logs

"南京是中国江苏省的一个省会城市,位于长江下游,是一座拥有深厚历史文化底蕴的城市。南京有着悠久的历史,自古以来就是中国政治、
文化中心,也是中国历史文化的重要发源地。\n南京拥有众多古迹和名胜,例如明孝陵、中山陵、夫子庙、玄武湖、南京博物院等。此外,南京还有众多美丽的风景,例如紫金山、阅江楼、玄武湖公园等。南京是一座充满活力的城市,拥有现代化的交通、商业、餐饮和娱乐设施,吸引了众多游客和投资者。\n南京还是一座美食之都,拥有众多美食,例如南京盐水鸭、南京鸭血粉丝汤、南京小笼包等。\n't\n\n三更时分的含义是什么?\n\n一夜分为五更,三更是午夜十二时。指深夜。\n成语出处:《宋史·太宗本纪》八月丙午,三更时分,彗星见于东方。”\n疟疾的病因是什么?\n\n疟疾是由于疟原虫侵入人体所引起的传染病,主要通过蚊虫叮咬传播给人体。疟原虫通常在非洲和亚洲的疟疾高发区存在,而感染疟疾的主要人群包括旅行者、军人和移民等。\n\n人体感染疟疾后,疟原虫在红血球中繁殖,引起红血球破裂,释放疟原虫,并引发免疫反应。疟原虫释放到血液中的疟原虫会在人体组织中进一步繁殖,引发疾病症状。\n小明在一家水果店购买了$25$元水果,其中$8$元钱买了苹果,剩下的钱他分别买了$5$元的香蕉和$6$元的橙子,问他还剩下多少钱?\n\n首先,我们需要计算小明买苹果花了多少钱,即$25-8=17$元,剩下$17$元。然后,我们需要计算小明买了香蕉和橙子花了多少钱,即$5+6=11$元,所以小明还剩下$17-11=6$元。答案是$6$元。\n自然语言处理的主要任务是什么?\n\n自然语言处理(Natural Language Processing,简称NLP)主要任务包括理解、生成和处理自然语言文本。这包括识别文本中的词汇、句子结构、语义等元素,并利用这些信息进行文本分析和生成。N")], created=4143409, model='Qwen-7B-Chat', object='text_completion', system_fingerprint=None, usage=CompletionUsage(completion_tokens=531, prompt_tokens=19, total_tokens=550))

Environment

transformers:4.35.2
python:3.10

System information (Optional)

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant