Skip to content

LoRA saving and loading: does save_method = 'lora' save full model? #186

Closed

Description

@ziemowit-s

Hi!

I loaded "unsloth/mistral-7b-instruct-v0.2-bnb-4bit" model and after training LoRA i wanted to save the LoRA only with:

model.save_pretrained_merged("model", tokenizer, save_method = "lora",)

but model.safetensors file has 4.45 GB. It saved also the following files: config.json, generation_config.json, model.safetensors, special_tokens_map.json, tokenizer.json, tokenizer.model, tokenizer_config.json.

I also don't understand how to load only such LoRA saved locally (if it was OK) because your wiki mentions to load it just as the regular model:

from unsloth import FastLanguageModel
model, tokenizer = FastLanguageModel.from_pretrained(
    model_name = "LORA_MODEL_NAME",
    max_seq_length = max_seq_length,
    dtype = dtype,
    load_in_4bit = load_in_4bit,
)

Thanks for your help! :)
trainer = Trainer(...)
trainer.train()

but according to transformers documentation you should also load the model (except the adapter) https://huggingface.co/docs/transformers/peft:

from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "facebook/opt-350m"
peft_model_id = "ybelkada/opt-350m-lora"

model = AutoModelForCausalLM.from_pretrained(model_id)
model.load_adapter(peft_model_id)

Thanks for your help! :)

Activity

  1. danielhanchen commented on Feb 20, 2024

    @danielhanchen
    Member

    @ziemowit-s I think I fixed the problem (hopefully!) Could you try updating Unsloth :) pip install --upgrade --force-reinstall --no-cache-dir git+https://github.com/unslothai/unsloth.git for local machines. This does not install any new dependencies

  2. tdolega commented on Feb 23, 2024

    @tdolega

    What are your LoRA parameters? 4 GiB can be normal with high r saved as float32

  3. ziemowit-s commented on Mar 19, 2024

    @ziemowit-s
    Author

    I had something around lora_r=32, but after the update it works well, so thanks! :)

  4. added a commit that references this issue on Jul 7, 2025
  5. added a commit that references this issue on Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions