Ver código fonte

LLM编码修复

ysyyhhh 1 ano atrás
pai
commit
ce8e3dd276
1 arquivos alterados com 6 adições e 6 exclusões
  1. 6 6
      LLM.py

+ 6 - 6
LLM.py

@@ -7,25 +7,25 @@ import torch
 
 
 class ChatGLM_LLM(LLM):
-    # ���ڱ��� InternLM �Զ��� LLM ��
+    # 基于本地 InternLM 自定义 LLM 类
     tokenizer: AutoTokenizer = None
     model: AutoModelForCausalLM = None
 
     def __init__(self, model_path: str):
-        # model_path: InternLM ģ��·��
-        # �ӱ��س�ʼ��ģ��
+        # model_path: InternLM 模型路径
+        # 从本地初始化模型
         super().__init__()
-        print("���ڴӱ��ؼ���ģ��...")
+        print("正在从本地加载模型...")
         self.tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
         self.model = AutoModelForCausalLM.from_pretrained(model_path, trust_remote_code=True).to(torch.bfloat16).cuda(
             device=1)
         self.model = self.model.eval()
-        print("��ɱ���ģ�͵ļ���")
+        print("完成本地模型的加载")
 
     def _call(self, prompt: str, stop: Optional[List[str]] = None,
               run_manager: Optional[CallbackManagerForLLMRun] = None,
               **kwargs: Any):
-        # ��д���ú���
+        # 重写调用函数
         response, history = self.model.chat(self.tokenizer, prompt, history=[], do_sample=False)
         return response