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

Minimal LoRA implementation #182

Merged
merged 35 commits into from
Mar 27, 2025
Merged

Minimal LoRA implementation #182

merged 35 commits into from
Mar 27, 2025

Conversation

jlamypoirier
Copy link
Collaborator

@jlamypoirier jlamypoirier commented Mar 11, 2025

✨ Description

Same as #180, but without the infrastructure changes needed to support LoRA/PEFT for MLP, TP, etc. Part of #149

  • Create Lora wrapper and Lora (peft) config
  • Support Lora for query and key_value layers, and add option to selecting which of them to apply lora on.
  • Add option to freeze non-lora weights
  • Add support for freezing entire layers/stages (disable backward pass if it's the first one(s), missing in Support frozen weights #185)
  • Make it work on a manual test
  • Prevent lora wrappers from messing up parameter names (breaks checkpoint conversion)
  • Support Lora on key and/or value separately
  • Checkpoint conversion (separate PR)
  • Add test(s)

🔍 Type of change

Select all that apply:

  • 🐛 Bug fix (non-breaking change that addresses a specific issue)
  • 🚀 New feature (non-breaking change that adds functionality)
  • ⚠️ Breaking change (a change that could affect existing functionality)
  • 📈 Performance improvement/optimization (improves speed, memory usage, or efficiency)
  • 🛠️ Code refactor (non-functional changes that improve code readability, structure, etc.)
  • 📦 Dependency bump (updates dependencies, including Dockerfile or package changes)
  • 📝 Documentation change (updates documentation, including new content or typo fixes)
  • 🔧 Infrastructure/Build change (affects build process, CI/CD, or dependencies)

@jlamypoirier jlamypoirier linked an issue Mar 11, 2025 that may be closed by this pull request
4 tasks
@jlamypoirier jlamypoirier changed the base branch from main to frozen_weights March 18, 2025 23:18
@jlamypoirier jlamypoirier marked this pull request as ready for review March 21, 2025 23:02
Copy link
Collaborator

@tscholak tscholak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is great!
import-export of HF-compatible PEFT weights is indeed better to keep for a follow-up ticket. thanks

@jlamypoirier
Copy link
Collaborator Author

@tscholak Opened #204. Will merge this one once #185 is merged to main.

Base automatically changed from frozen_weights to main March 27, 2025 02:45
@jlamypoirier jlamypoirier merged commit ab17636 into main Mar 27, 2025
4 checks passed
@jlamypoirier jlamypoirier deleted the lora_small branch March 27, 2025 03:11
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.

[feat] LoRA
3 participants