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

公布的LongLM模型在OutGen任务的生成结果不对 #4

Open
BlinkDL opened this issue Jan 26, 2022 · 4 comments
Open

公布的LongLM模型在OutGen任务的生成结果不对 #4

BlinkDL opened this issue Jan 26, 2022 · 4 comments

Comments

@BlinkDL
Copy link

BlinkDL commented Jan 26, 2022

你好,测试LongLM模型,在填空任务的输出正确:

两个多小时后,石峰把四百五十块灵石,花了一个干干净净,而狼城各大药材店中,<extra_id_1>丹的药材,也被石峰搜罗一空。回到住处,<extra_id_2>没有片刻停歇,人极境界用到的回气丹<extra_id_3>,<extra_id_4>这种丹药,对于石峰来说,没有<extra_id_5>一炉炉丹药不断出炉,石峰和小黑的脸<extra_id_6>了花。

可以得到正确输出:

<s>▁<extra_id_1>炼<extra_id_2>石峰和小黑<extra_id_3>药<extra_id_4>都得到了<extra_id_5>什么用处。<extra_id_6>色都变了,脸上都绽放</s>

但是,在OutGen任务的生成结果不对,似乎没有特殊处理#字符。
我用 https://github.com/thu-coai/LOT-LongLM/blob/7cf5377f20656732542221a876ae7fb86e85fcdc/baselines/generation/test.source 的输入:

宠妃为国王设计#国王卫队见状慌忙跑#命令卫队守#整日沉迷于酒池肉林#时间来到王宫#卫队心#起义军打开#起义军搜寻#不务政事<extra_id_1>

得到的输出:

<s>▁<extra_id_1>##大军看着#起义军高兴的手舞足蹈#军心#不务政事#军的心#城#城门#城内#城门(城)#城&城&城门#城的城#城(城内)#城门&城门&城#门&城@城门&城内#城中#城,#城。</s>

它认为#是普通字符,所以产生了大量#。请问OutGen任务是否需要不同的输入格式,谢谢。

@JianGuanTHU
Copy link
Member

感谢关注!填空任务和续写任务是LongLM的预训练任务,可以直接不经过finetune就进行生成。OutGen任务是我们设计LOT benchmark中的的一个下游任务,需要对LongLM在相应的训练集上进行训练才能正确生成。

@BlinkDL
Copy link
Author

BlinkDL commented Jan 31, 2022

感谢关注!填空任务和续写任务是LongLM的预训练任务,可以直接不经过finetune就进行生成。OutGen任务是我们设计LOT benchmark中的的一个下游任务,需要对LongLM在相应的训练集上进行训练才能正确生成。

请问之前在OutGen微调后的模型还有么,谢谢。可以分享啊。

@ouhongxu
Copy link

您好,我在测试LongLM模型的在填空任务时,用的您上面的输入示例,但是得到的输出不尽人意,您可以提供一下你当时的测试代码吗?非常感谢~

from transformers import T5Tokenizer, T5ForConditionalGeneration
tokenizer = T5Tokenizer.from_pretrained('thu-coai/LongLM-large')
model = T5ForConditionalGeneration.from_pretrained('thu-coai/LongLM-large')

text = "两个多小时后,石峰把四百五十块灵石,花了一个干干净净,而狼城各大药材店中,<extra_id_1>丹的药材,也被石峰搜罗一空。回到住处,<extra_id_2>没有片刻停歇,人极境界用到的回气丹<extra_id_3>,<extra_id_4>这种丹药,对于石峰来说,没有<extra_id_5>一炉炉丹药不断出炉,石峰和小黑的脸<extra_id_6>了花。"

input_ids = tokenizer(text, return_tensors="pt").input_ids
gen = model.generate(input_ids)
print(tokenizer.batch_decode(gen))

# 输出如下:
# ['<s> <extra_id_1>><extra_id_6>,石峰的脸色越来越难看了。石峰回到住处,小黑也回来了,</s>']

@JianGuanTHU
Copy link
Member

@ouhongxu 请参考示例生成代码

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

3 participants