YuanGongND / ltu

Code, Dataset, and Pretrained Models for Audio and Speech Large Language Model "Listen, Think, and Understand".
389 stars 36 forks source link

Question: Where is the setting to freeze the backbone LLM like LLaVA? #47

Open Kurt232 opened 2 months ago

Kurt232 commented 2 months ago
# LLaVA
if model_args.freeze_backbone:
        model.model.requires_grad_(False)

In LTU code, only note the LLM has already frozen.

    # for audio params, lora always trainable, llama always frozen
    for name, param in model.named_parameters():
        if trainable_params == 'all':
            if "audio" in name:
                param.requires_grad = True
                #print(f"Parameter: {name}, requires_grad: {param.requires_grad}")
        if trainable_params == 'proj':
            if "audio_proj" in name:
                param.requires_grad = True
                #print(f"Parameter: {name}, requires_grad: {param.requires_grad}")
YuanGongND commented 2 months ago

can you be more specific on the question.

if I understand the question correctly, the freeze is in here https://github.com/YuanGongND/ltu/blob/2002aad8305ee5579a2237a85a6e792c1174cda7/src/ltu_as/peft-main/src/peft/tuners/lora.py#L363-L377, which happens when you do:

https://github.com/YuanGongND/ltu/blob/2002aad8305ee5579a2237a85a6e792c1174cda7/src/ltu_as/finetune.py#L191

so we are actually adding trainable parameters back rather than explicitly freeze some parameters.

-Yuan