Skip to content

InCorrect LoRALayer initialization of lora_A #11

@Icontofig

Description

@Icontofig

Hello. I'm troubling with the LoRALayer Defination in src/t5_prompt.py.

I followed your modify of modeling_t5.py(t5_prompt.py) to modify a Bart. But During Training I got the grad of LoRALayer all zero. I checked the parameters of the LoRALayer and got that both lora_A and lora_B is all zero.

Things are solved after I modified the defination of lora_A as following:

std_dev = 1 / torch.sqrt(torch.tensor(r).float())#after modified  
self.lora_A = nn.Parameter(torch.randn((in_features, r)) * std_dev, requires_grad = True) #after modified  
# self.lora_A = nn.Parameter(torch.zeros((in_features, r)), requires_grad = True) # before modified  

So I'm not sure that if you have uploaded an incorrent version of src/t5_prompt.py.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions