nxphi47 commited on
Commit
5c05afa
1 Parent(s): 71824cc

Update multipurpose_chatbot/engines/transformers_engine.py

Browse files
multipurpose_chatbot/engines/transformers_engine.py CHANGED
@@ -418,7 +418,7 @@ class TransformersEngine(BaseEngine):
418
  assert self._tokenizer.chat_template is not None and self._tokenizer.chat_template != "", f"{self._tokenizer.chat_template=} not found!"
419
  self._model = AutoModelForCausalLM.from_pretrained(model_path, torch_dtype=self.torch_dtype, device_map=self.device_map, trust_remote_code=True).eval()
420
  self._model.sample_old = self._model.sample
421
- self._model.sample = types.MethodType(NewGenerationMixin.sample_stream, self._model)
422
  print(self._model)
423
  print(f"{self.max_position_embeddings=}")
424
 
 
418
  assert self._tokenizer.chat_template is not None and self._tokenizer.chat_template != "", f"{self._tokenizer.chat_template=} not found!"
419
  self._model = AutoModelForCausalLM.from_pretrained(model_path, torch_dtype=self.torch_dtype, device_map=self.device_map, trust_remote_code=True).eval()
420
  self._model.sample_old = self._model.sample
421
+ self._model._sample = types.MethodType(NewGenerationMixin.sample_stream, self._model)
422
  print(self._model)
423
  print(f"{self.max_position_embeddings=}")
424