镜像自地址
https://github.com/SCIR-HI/Med-ChatGLM.git
已同步 2025-12-07 07:06:49 +00:00
v0.1 commit
这个提交包含在:
13
infer.py
普通文件
13
infer.py
普通文件
@@ -0,0 +1,13 @@
|
||||
import torch
|
||||
from transformers import AutoTokenizer, AutoModel
|
||||
from modeling_chatglm import ChatGLMForConditionalGeneration
|
||||
tokenizer = AutoTokenizer.from_pretrained(
|
||||
"./model", trust_remote_code=True)
|
||||
model = ChatGLMForConditionalGeneration.from_pretrained(
|
||||
"./model").half().cuda()
|
||||
while True:
|
||||
a = input("请输入您的问题:(输入q以退出)")
|
||||
if a.strip() == 'q':
|
||||
exit()
|
||||
response, history = model.chat(tokenizer, "问题:" + a.strip() + '\n答案:', max_length=256, history=[])
|
||||
print("回答:", response)
|
||||
在新工单中引用
屏蔽一个用户