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

Documentation for LoRAConfig. #2212

Open
brynhayder opened this issue Nov 12, 2024 · 3 comments
Open

Documentation for LoRAConfig. #2212

brynhayder opened this issue Nov 12, 2024 · 3 comments

Comments

@brynhayder
Copy link

brynhayder commented Nov 12, 2024

initialization scaled by the LoRA rank for linear and layers. Setting the initialization to False leads to
completely random initialization and is discouraged. Pass `'loftq'` to use LoftQ initialization. Pass

Documentation for False is not clear. Presumably 'completely random' means the arrays will be uninitialized and hence contain whatever the contents of the relevant memory locations are?

@BenjaminBossan
Copy link
Member

To explain further: The default implementation initializes the LoRA A parameter randomly and the LoRA B parameter to zeros. This results in LoRA being an identity transform at initialization, which can help with training. When setting init_lora_weights=False, the LoRA B weight is instead also randomly initialized, resulting in a non-identity transform.

For real LoRA training, you almost never want that, which is why we discourage it. However, the weights are not initialized as random memory as in torch.empty, which seems to be what you suspected.

Copy link

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

@brynhayder
Copy link
Author

To explain further: The default implementation initializes the LoRA A parameter randomly and the LoRA B parameter to zeros. This results in LoRA being an identity transform at initialization, which can help with training. When setting init_lora_weights=False, the LoRA B weight is instead also randomly initialized, resulting in a non-identity transform.

For real LoRA training, you almost never want that, which is why we discourage it. However, the weights are not initialized as random memory as in torch.empty, which seems to be what you suspected.

Thanks. Is it possible to update the docs to explain what you've just said? I think this should be clear in the docs.

@BenjaminBossan BenjaminBossan reopened this Jan 6, 2025
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