Unverified 提交 31655339 作者: Tyler Luan 提交者: GitHub

chatglm init twice (#313)

上级 2987c9cd
...@@ -141,16 +141,16 @@ class ChatGLM(LLM): ...@@ -141,16 +141,16 @@ class ChatGLM(LLM):
else: else:
from accelerate import dispatch_model from accelerate import dispatch_model
model = AutoModel.from_pretrained(model_name_or_path, trust_remote_code=True, # model = AutoModel.from_pretrained(model_name_or_path, trust_remote_code=True,
config=model_config, **kwargs) # config=model_config, **kwargs)
if LLM_LORA_PATH and use_lora: if LLM_LORA_PATH and use_lora:
from peft import PeftModel from peft import PeftModel
model = PeftModel.from_pretrained(model, LLM_LORA_PATH) model = PeftModel.from_pretrained(self.model, LLM_LORA_PATH)
# 可传入device_map自定义每张卡的部署情况 # 可传入device_map自定义每张卡的部署情况
if device_map is None: if device_map is None:
device_map = auto_configure_device_map(num_gpus) device_map = auto_configure_device_map(num_gpus)
self.model = dispatch_model(model.half(), device_map=device_map) self.model = dispatch_model(self.model.half(), device_map=device_map)
else: else:
self.model = self.model.float().to(llm_device) self.model = self.model.float().to(llm_device)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论