huggingface / peft

🤗 PEFT: State-of-the-art Parameter-Efficient Fine-Tuning.
https://huggingface.co/docs/peft
Apache License 2.0
16.32k stars 1.61k forks source link

Invalid `none` check for loftq_config attribute in `LoraConfig` #2170

Open sirluk opened 2 weeks ago

sirluk commented 2 weeks ago

System Info

Who can help?

@BenjaminBossan

Information

Tasks

Reproduction

from peft import LoraConfig

LoraConfig(init_lora_weights="loftq")

From the code in peft.tuners.lora.config.py this should raise a ValueError.

if self.loftq_config is None:
    raise ValueError("`loftq_config` must be specified when `init_lora_weights` is 'loftq'.")

However the loftq_config field of LoraConfig is defined to be a dict by default, so it is never None.

Expected behavior

ValueError should be raised when init_lora_weights="loftq" but loftq_config is not specified.

BenjaminBossan commented 1 week ago

Good catch, indeed this check doesn't make sense as is. I'll fix it once I have a bit of time (it's not high priority). If someone else wants to take this, feel free to do so.

sparsh2 commented 1 week ago

@BenjaminBossan I would like to take this up if its okay

sirluk commented 1 week ago

@BenjaminBossan @sparsh2 If its fine I would do it since I already started working on it as part of a different pull request that ideally should have the same structure as the fix for this

BenjaminBossan commented 1 week ago

Thanks, please go ahead @sirluk since you already started to work on it. @sparsh2 I hope you did not put any time into this yet.

sparsh2 commented 1 week ago

No issues @sirluk @BenjaminBossan. @sirluk please go aheahd