Skip to content

Commit

Permalink
Update llama.py
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhanchen committed Jun 5, 2024
1 parent 8380710 commit 3771f5d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions unsloth/models/llama.py
Original file line number Diff line number Diff line change
Expand Up @@ -1853,9 +1853,11 @@ def for_inference(model):
pass

# Wrap model.generate
model._unwrapped_old_generate = model.generate
model.generate = _wrap_fast_inference(model.generate, device_type, dtype, model)

if model.generate.__name__ != "_fast_generate":
model._unwrapped_old_generate = model.generate
model.generate = _wrap_fast_inference(model.generate, device_type, dtype, model)
pass

# Patch tokenizer to pad to the left
internal_model = model
while hasattr(internal_model, "model"):
Expand Down

0 comments on commit 3771f5d

Please sign in to comment.