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

官方示例输出,是否符合期望? #24

Closed
yucc-leon opened this issue Jun 15, 2023 · 7 comments
Closed

官方示例输出,是否符合期望? #24

yucc-leon opened this issue Jun 15, 2023 · 7 comments

Comments

@yucc-leon
Copy link

第一行是输入

Baichuan-User: 登鹳雀楼->王之涣\n夜雨寄北->\n
登鹳雀楼->王之涣\n夜雨寄北->\n客至->\n望月怀远->\n凉州词->\n
一、根据诗句的意思,给下列古诗找出对应的作者
1、一览众山小\n( \n)
2、飞流直下三千尺\n( \n)
3、春风又绿江南岸\n( \n)
4、但看黄河入海流\n( \n)
5、日暮乡关何处是\n( \n)
6、但愿人长久\n( \n)
7、举头望明月,低头思故乡\n( \n)
8、故人西辞黄鹤楼\n( \n)
9、无边落木萧萧下\n( \n)
10、一览众山小
作者( \n)
11、飞流直下三千尺
作者( \n)
12、春风又绿江南岸
作者( \n)
13、但看黄河入海流
作者( \n)
14、日暮乡关何处是
作者( \n)
15、但愿人长久
作者( \n)
16、举头望明月,低头思故乡
作者( \n)
17、故人西辞黄鹤楼
作者( \n)
18、无边落木萧萧下
作者( \n)
19、一览众山小
作者( \n)
20、春风又绿江南岸
作者( \n)
21、但看黄河入海流
作者( \n)
22、日暮乡关何处是
作者( \n)
23、但愿人长久
作者( \n)
24、举头望明月,低头思故乡
作者
@hazy217
Copy link

hazy217 commented Jun 15, 2023

我也遇到了类似的问题,感觉输出大部分时间都不太符合预期

@Nisoka
Copy link

Nisoka commented Jun 15, 2023

能否提供一个脚本参数,让模型正常起来

@expresschen
Copy link

遇到同样的问题

@zmsn-2077
Copy link
Collaborator

推理代码:

from transformers import AutoModelForCausalLM, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("/home/user/models/pre/baichuan-7b", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("/home/user/models/pre/baichuan-7b", device_map="auto", trust_remote_code=True)
inputs = tokenizer('登鹳雀楼->王之涣\n夜雨寄北->', return_tensors='pt')
inputs = inputs.to('cuda:0')
pred = model.generate(**inputs, max_new_tokens=64)
print(tokenizer.decode(pred.cpu()[0], skip_special_tokens=True))

the output:
image

@shibing624
Copy link

image 不完全一致

@SHENbeyond
Copy link

@yucc-leon @expresschen 结尾不要\n

@yucc-leon
Copy link
Author

yucc-leon commented Jun 16, 2023

image
image
看来部分输出是符合预期的,但需要做一些限制。

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

8 participants