Skip to content

Fix LoRA embedding parameter initialization - #209

Open
Aditya Biranje (AdityaBiranje) wants to merge 1 commit into
microsoft:mainfrom
AdityaBiranje:fix-embedding-initialization
Open

Fix LoRA embedding parameter initialization#209
Aditya Biranje (AdityaBiranje) wants to merge 1 commit into
microsoft:mainfrom
AdityaBiranje:fix-embedding-initialization

Conversation

@AdityaBiranje

Copy link
Copy Markdown

Description

Fixes the LoRA parameter initialization in Embedding to match the initialization used by Linear.

Previously, Embedding initialized lora_A to zeros and lora_B from a normal distribution. This was inconsistent with the expected LoRA initialization and with the existing Linear implementation.

The change initializes:

  • lora_A with Kaiming uniform initialization
  • lora_B with zeros

A regression test was added to verify the initialization behavior for both Embedding and Linear.

Testing

python -m pytest -q tests/test_layers.py
2 passed

The test was run locally on Apple Silicon using PyTorch 2.14.0.

Closes #194

@AdityaBiranje

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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

Successfully merging this pull request may close these issues.

Confusing logic for reset_parameters() in Embedding and Linear layer

1 participant