"如何保证modelscope中同样的输入内容每次返回的结果也相同呢?
tokenizer = AutoTokenizer.from_pretrained(""Qwen/Qwen-1_8B-Chat"", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(""Qwen/Qwen-1_8B-Chat"", device_map=""auto"",
trust_remote_code=True).eval()
input_strings = [""你好呀"", ""你好呀"", ""你好呀"", ""你好呀""]
for input_text in input_strings:
# 与模型交互
response, _ = model.chat(tokenizer, input_text, history=None,
system=""""""【任务:信息分类】\n请严格根据提供分类选项对输入内容进行分类,并直接回复类别名称:\n科技\n就业\n财经\n其它\n"""""")
print(response)"
目前的模型列表中还没有这个模型,您看下自定义拓展,https://github.com/modelscope/swift/blob/main/docs/source/LLM/%E8%87%AA%E5%AE%9A%E4%B9%89%E4%B8%8E%E6%8B%93%E5%B1%95.md 此回答整理自钉群“魔搭ModelScope开发者联盟群 ①”
ModelScope旨在打造下一代开源的模型即服务共享平台,为泛AI开发者提供灵活、易用、低成本的一站式模型服务产品,让模型应用更简单!欢迎加入技术交流群:微信公众号:魔搭ModelScope社区,钉钉群号:44837352