#Different results using different peft methods

1 messages · Page 1 of 1 (latest)

somber mauve
#

Hello,
First of all, sorry if this question is dumb, but I am very new to this finetuning world.
I am currently finetuning a model for log analysis, and I am using the new gemma3 1B parameters model.
The thing I was doing was my training using the higgingface's LoraConfig class like this:

peft_config = LoraConfig(
    r=config["lora_rank"],
    lora_alpha=64,
    target_modules=["q_proj", "k_proj", "v_proj", "o_proj"],
    task_type="CAUSAL_LM",
    inference_mode=False,
)

# Apply PEFT
model = get_peft_model(model, peft_config)```


Then I discover that unsloth had something similar, and I changed to this :


```py
model = FastLanguageModel.get_peft_model(
    model,
    r=config["lora_rank"],
    lora_alpha=64,
    target_modules=["q_proj", "k_proj", "v_proj", "o_proj"],
    task_type="CAUSAL_LM",  # Include task_type for clarity
    inference_mode=False,
)

# Apply PEFT
model.print_trainable_parameters()```


The problem is that after I changed to this I got terrible results with my new trained model.
I am sure I only changed this, and the rest is exactly the same.
Do I need to do something else, or change anything?
PS: I am loading the model in a separate script like this.


```py
from transformers import AutoTokenizer
from unsloth import FastLanguageModel
from peft import PeftModel, PeftConfig


tokenizer = AutoTokenizer.from_pretrained(config["tokenizer_dir"])

model, _ = FastLanguageModel.from_pretrained(
        config["model_dir"],
        max_seq_length=config["max_seq_length"],
        load_in_4bit=True,  # Must match training quantization
)
model.resize_token_embeddings(len(tokenizer))
model = PeftModel.from_pretrained(model, config["model_dir"])



model.resize_token_embeddings(len(tokenizer)) ```
Maybe I need to load it in a different way when I train with the unsloth method? 

Thank you for you help.
#

Different results using different peft methods

sharp gate
#

You're mixing calls to transformers methods, peft and unsloth

#

you should keep it aligned with how it's showcased in the notebooks

somber mauve
#

Yes I agree with you, I should only use unsloth methods.
So I should train like this:

model = FastLanguageModel.get_peft_model(
    model,
    r=config["lora_rank"],
    lora_alpha=64,
    target_modules=["q_proj", "k_proj", "v_proj", "o_proj"],
    task_type="CAUSAL_LM",  # Include task_type for clarity
    inference_mode=False,
)

# Apply PEFT
model.print_trainable_parameters()

But I am havin trouble finding a way to load the model that I just trained, because usually in the examples they just used the model that they have just trained, but I want to use the model in a seperate script so that's not possible.
A example I found was in the Gemma3 4B notebook that looks like this:

from unsloth import FastModel
    model, tokenizer = FastModel.from_pretrained(
        model_name = "lora_model", # YOUR MODEL YOU USED FOR TRAINING
        max_seq_length = 2048,
        load_in_4bit = True,
    )```

How do I check if this actually worked and the training was "applied"
sharp gate
#

the notebooks show you how to save models after training

#

and you benchmark or evaluate the model as simple as that

#

You need to read more if you're struggling with these concepts because this is not exactly super easy stuff

#

also search for tutorials