Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type Error: '<=' not supported between instances of 'LoraConfig' and 'int' #27

Closed
qy1026 opened this issue Dec 11, 2023 · 5 comments
Closed

Comments

@qy1026
Copy link

qy1026 commented Dec 11, 2023

There is an Error when I implement unsloth. I also propose this issue in peft github repo.

huggingface/peft#1248

@danielhanchen
Copy link
Contributor

@qy1026 Does this happen if you run the Alpaca example via Google Colab?

@qy1026
Copy link
Author

qy1026 commented Dec 12, 2023

use get_peft_model(model, r, target_modules, ...), DO NOT use get_peft_model(model, config)

@qy1026 qy1026 closed this as completed Dec 12, 2023
@qy1026 qy1026 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 12, 2023
@qy1026 qy1026 reopened this Dec 12, 2023
@qy1026 qy1026 closed this as completed Dec 12, 2023
@danielhanchen
Copy link
Contributor

@qy1026 I'm sorry - are you saying the calling convention for get_peft_model has changed? I just ran Unsloth via Google Colab and it looks fine.

Am I doing something else wrong which causes ur code to break?

@danielhanchen danielhanchen reopened this Dec 12, 2023
@qy1026
Copy link
Author

qy1026 commented Dec 12, 2023

I want to combine unsloth with a qlora fitune framework named firefly. The code of model and LoraConfig is as follows:

config = LoraConfig(
        r=args.lora_rank,
        lora_alpha=args.lora_alpha,
        target_modules=target_modules,
        lora_dropout=args.lora_dropout,
        bias="none",
        task_type="CAUSAL_LM",
    )
model = get_peft_model(model, config)

while the code in unsloth is :

# Do model patching and add fast LoRA weights
model = FastLlamaModel.get_peft_model(
    model,
    r = 16,
    target_modules = ["q_proj", "k_proj", "v_proj", "o_proj",
                      "gate_proj", "up_proj", "down_proj",],
    lora_alpha = 16,
    lora_dropout = 0, # Currently only supports dropout = 0
    bias = "none",    # Currently only supports bias = "none"
    use_gradient_checkpointing = True,
    random_state = 3407,
    max_seq_length = max_seq_length,
)

I wrongly pass the parameter config into the FastLlamaModel.get_peft_model, which caused the TypeError. The correct way is passing the necessary parameter seperately.

@qy1026 qy1026 closed this as completed Dec 12, 2023
@danielhanchen
Copy link
Contributor

@qy1026 Oh ok!!! Tell me how the finetuning goes! Hopefully it makes it superfast!! :) Again thanks for using Unsloth!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants