安装了Modelscope,也装了ChatYuan-large-v2模型 进入python后输入:
from modelscope.utils.constant import Tasks
from modelscope.models.nlp import T5ForConditionalGeneration
from modelscope.preprocessors import TextGenerationT5Preprocessor
model = T5ForConditionalGeneration.from_pretrained('ClueAI/ChatYuan-large-v2', revision='v1.0.0')
preprocessor = TextGenerationT5Preprocessor(model.model_dir)
p = pipeline(task=Tasks.text2text_generation, model=model, preprocessor=preprocessor)
然后执行对话命令: p('用户:写一篇文章,题目是未来城市\n小元:',)
得到的回复是: {'text': '未来城市,是人类智慧和科技的结晶,它将引领城市发展的方向,引领'} 每次回复都只有这么点长度,请问我需要修改哪部分才能够让他的回复长度变长