Skip to content

Commit 397bb72

Browse files
authored
Fix renaming on other model than Llama (#2762)
1 parent 9d98489 commit 397bb72

File tree

8 files changed

+8
-8
lines changed

8 files changed

+8
-8
lines changed

unsloth/models/cohere.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ def pre_patch():
466466
CohereDecoderLayer .forward = CohereDecoderLayer_fast_forward
467467
CohereModel .forward = LlamaModel_fast_forward
468468
CohereForCausalLM .forward = CausalLM_fast_forward(CohereModel_fast_forward_inference)
469-
PeftModelForCausalLM .forward = PeftModelForCausalLM_fast_forward
469+
PeftModelForCausalLM .forward = PeftModel_fast_forward
470470
fix_prepare_inputs_for_generation(CohereForCausalLM)
471471

472472
import transformers.models.cohere.modeling_cohere

unsloth/models/gemma.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ def pre_patch():
332332
GemmaDecoderLayer .forward = GemmaDecoderLayer_fast_forward
333333
GemmaModel .forward = LlamaModel_fast_forward
334334
GemmaForCausalLM .forward = CausalLM_fast_forward(GemmaModel_fast_forward_inference)
335-
PeftModelForCausalLM.forward = PeftModelForCausalLM_fast_forward
335+
PeftModelForCausalLM.forward = PeftModel_fast_forward
336336
fix_prepare_inputs_for_generation(GemmaForCausalLM)
337337

338338
# Solves https://github.com/unslothai/unsloth/issues/168

unsloth/models/gemma2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ def pre_patch():
477477
Gemma2DecoderLayer .forward = Gemma2DecoderLayer_fast_forward
478478
Gemma2Model .forward = LlamaModel_fast_forward
479479
Gemma2ForCausalLM .forward = CausalLM_fast_forward(Gemma2Model_fast_forward_inference)
480-
PeftModelForCausalLM .forward = PeftModelForCausalLM_fast_forward
480+
PeftModelForCausalLM .forward = PeftModel_fast_forward
481481
fix_prepare_inputs_for_generation(Gemma2ForCausalLM)
482482

483483
# Solves https://github.com/unslothai/unsloth/issues/168

unsloth/models/granite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ def pre_patch():
468468
GraniteModel .forward = LlamaModel_fast_forward
469469
GraniteForCausalLM .forward = CausalLM_fast_forward(GraniteModel_fast_forward_inference)
470470
GraniteForCausalLM .__init__ = patched_init(GraniteForCausalLM.__init__)
471-
PeftModelForCausalLM .forward = PeftModelForCausalLM_fast_forward
471+
PeftModelForCausalLM .forward = PeftModel_fast_forward
472472
fix_prepare_inputs_for_generation(GraniteForCausalLM)
473473

474474
import transformers.models.granite.modeling_granite

unsloth/models/mistral.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def pre_patch():
368368
MistralDecoderLayer .forward = LlamaDecoderLayer_fast_forward
369369
MistralModel .forward = LlamaModel_fast_forward
370370
MistralForCausalLM .forward = MistralForCausalLM_fast_forward
371-
PeftModelForCausalLM .forward = PeftModelForCausalLM_fast_forward
371+
PeftModelForCausalLM .forward = PeftModel_fast_forward
372372
fix_prepare_inputs_for_generation(MistralForCausalLM)
373373

374374
# Solves https://github.com/unslothai/unsloth/issues/168

unsloth/models/qwen2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def pre_patch():
5555
Qwen2DecoderLayer .forward = LlamaDecoderLayer_fast_forward
5656
Qwen2Model .forward = LlamaModel_fast_forward
5757
Qwen2ForCausalLM .forward = CausalLM_fast_forward(LlamaModel_fast_forward_inference)
58-
PeftModelForCausalLM.forward = PeftModelForCausalLM_fast_forward
58+
PeftModelForCausalLM.forward = PeftModel_fast_forward
5959
fix_prepare_inputs_for_generation(Qwen2ForCausalLM)
6060

6161
# Solves https://github.com/unslothai/unsloth/issues/168

unsloth/models/qwen3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ def pre_patch():
387387
Qwen3DecoderLayer .forward = LlamaDecoderLayer_fast_forward
388388
Qwen3Model .forward = LlamaModel_fast_forward
389389
Qwen3ForCausalLM .forward = CausalLM_fast_forward(_LlamaModel_fast_forward_inference(Qwen3Attention_fast_forward_inference))
390-
PeftModelForCausalLM.forward = PeftModelForCausalLM_fast_forward
390+
PeftModelForCausalLM.forward = PeftModel_fast_forward
391391
fix_prepare_inputs_for_generation(Qwen3ForCausalLM)
392392

393393
# Solves https://github.com/unslothai/unsloth/issues/168

unsloth/models/qwen3_moe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def pre_patch():
177177
Qwen3MoeDecoderLayer .forward = Qwen3MoeDecoderLayer_fast_forward
178178
Qwen3MoeModel .forward = LlamaModel_fast_forward
179179
Qwen3MoeForCausalLM .forward = CausalLM_fast_forward(LlamaModel_fast_forward_inference)
180-
PeftModelForCausalLM.forward = PeftModelForCausalLM_fast_forward
180+
PeftModelForCausalLM.forward = PeftModel_fast_forward
181181
fix_prepare_inputs_for_generation(Qwen3MoeForCausalLM)
182182

183183
# Solves https://github.com/unslothai/unsloth/issues/168

0 commit comments

Comments
 (0)