Update llama.py
This commit is contained in:
parent
f79b6b4cbe
commit
254988c404
1 changed files with 7 additions and 1 deletions
|
|
@ -1017,7 +1017,6 @@ def CausalLM_fast_forward(fast_forward_inference):
|
|||
logits_to_keep: Optional[int] = 0,
|
||||
*args, **kwargs,
|
||||
) -> Union[Tuple, CausalLMOutputWithPast]:
|
||||
print(past_key_values)
|
||||
if past_key_values is not None:
|
||||
outputs = fast_forward_inference(
|
||||
self,
|
||||
|
|
@ -2664,6 +2663,13 @@ class FastLlamaModel:
|
|||
model.load_lora = functools.partial(load_lora, model)
|
||||
pass
|
||||
|
||||
# Patch generate
|
||||
if model.generate.__name__ != "unsloth_fast_generate":
|
||||
model._old_generate = model.generate
|
||||
unsloth_fast_generate.__doc__ = model._old_generate.__doc__
|
||||
model.generate = types.MethodType(unsloth_fast_generate, model)
|
||||
pass
|
||||
|
||||
# Add for_inference and for_training
|
||||
model.for_training = functools.partial(FastLlamaModel.for_training, model)
|
||||
model.for_inference = functools.partial(FastLlamaModel.for_inference, model)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue