lyhue1991 / torchkeras

Pytorch❤️ Keras 😋😋
Apache License 2.0
1.72k stars 224 forks source link

模型好像更新了,无法调用 #88

Closed 14790897 closed 7 months ago

14790897 commented 9 months ago
#注册魔法命令便于jupyter中使用
from torchkeras.chat import ChatGLM 
chatglm = ChatGLM(model,tokenizer,stream=True)
​
register magic %%chatglm sucessed ...
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[13], line 3
      1 #注册魔法命令便于jupyter中使用
      2 from torchkeras.chat import ChatGLM 
----> 3 chatglm = ChatGLM(model,tokenizer,stream=True)

File /opt/conda/lib/python3.10/site-packages/torchkeras/chat/chatglm.py:26, in ChatGLM.__init__(self, model, tokenizer, stream, max_chat_rounds, history, max_length, num_beams, do_sample, temperature, logits_processor)
     23     print('register magic %%chatglm failed ...')
     24     print(err)
---> 26 response = self('你好')
     27 if not self.stream:
     28     print(response)

File /opt/conda/lib/python3.10/site-packages/torchkeras/chat/chatglm.py:46, in ChatGLM.__call__(self, query)
     38     response,self.history  = self.model.chat(self.tokenizer,
     39      query,self.history,self.max_length,self.num_beams,
     40      self.do_sample,self.top_p,self.temperature,
     41      self.logits_processor)
     42     return response 
     44 result = self.model.stream_chat(self.tokenizer,
     45     query,self.history,None,self.max_length,
---> 46     self.do_sample,self.top_p,self.temperature,
     47     self.logits_processor,None)
     49 for response,history in result:
     50     print(response)

AttributeError: 'ChatGLM' object has no attribute 'top_p'

https://github.com/lyhue1991/torchkeras/blob/377e83887a4b42da253b0ffeecdd152be157facf/examples/ChatGLM2_QLoRA_Kaggle%E2%80%94%E2%80%94transformers.ipynb#L758-L762

Jack0000007 commented 7 months ago

遇到了同样的问题,请问楼主该怎么解决

14790897 commented 7 months ago

遇到了同样的问题,请问楼主该怎么解决

还解决个屁,换别的