Skip to content

Do Unsloth support LoftQ? #86

Closed
Closed

Activity

  1. danielhanchen commented on Jan 13, 2024

    @danielhanchen
    Member

    @hahuyhoang411 I think it should work. I put *args, **kwargs for .get_peft_model so put ur LoftQ config inside:

    FastLanguageModel.get_peft_model(
        ...,
        init_lora_weights="loftq",
        loftq_config = loftq_config,
    )
    

    I haven't tried it, but it should work

  2. hahuyhoang411 commented on Jan 13, 2024

    @hahuyhoang411
    Author

    I don't know if it's a problem with Unsloth or Tinyllama architecture. I received this:

         54         # LoRA is enabled
         55         A, B = A.t(), B.t()
    ---> 56         out += (X @ A.to(dtype)) @ (s * B.to(dtype))
         57     pass
         58 
    
    RuntimeError: mat1 and mat2 shapes cannot be multiplied (724x2048 and 1x1)
    

    This is the notebook: https://colab.research.google.com/drive/10mn462VW2hY5-DTpRdYY4MyTEJeJYtj_?usp=sharing

  3. danielhanchen commented on Jan 13, 2024

    @danielhanchen
    Member

    @hahuyhoang411 I think for LoftQ, one must set load_in_4bit = False

  4. hahuyhoang411 commented on Jan 16, 2024

    @hahuyhoang411
    Author

    I don't think I load_in_4bit I excluded it out of the loading model process

    model, tokenizer = FastLanguageModel.from_pretrained(
        model_name = "TinyLlama/TinyLlama-1.1B-Chat-v1.0", # "unsloth/mistral-7b" for 16bit loading
        max_seq_length = max_seq_length,
        dtype = dtype
        # token = "hf_...", # use one if using gated models like meta-llama/Llama-2-7b-hf
    )
    
  5. danielhanchen commented on Jan 16, 2024

    @danielhanchen
    Member

    @hahuyhoang411 You must use load_in_4bit = False since I default set it to True

  6. hahuyhoang411 commented on Jan 16, 2024

    @hahuyhoang411
    Author

    Ah I see, I works. Thank you for your help

  7. danielhanchen commented on Jan 16, 2024

    @danielhanchen
    Member

    Cool!

  8. added a commit that references this issue on Jun 8, 2025
  9. added a commit that references this issue on Jun 25, 2025
  10. added a commit that references this issue on Jul 7, 2025
  11. 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