feat: Add LoRA (Low-Rank Adaptation) support for efficient model fine-tuning#108
Open
chen2021673 wants to merge 2 commits intomasterfrom
Open
feat: Add LoRA (Low-Rank Adaptation) support for efficient model fine-tuning#108chen2021673 wants to merge 2 commits intomasterfrom
chen2021673 wants to merge 2 commits intomasterfrom
Conversation
- Add LoRA module infrastructure with configurable rank, alpha, dropout - Implement LoRALinear wrapper for seamless integration with Linear layers - Support tensor parallelism via LoRAParallelLinear - Add LoRAModel utility for managing multiple LoRA layers - Integrate LoRA configuration and utilities - Add GPT2 example demonstrating LoRA fine-tuning - Include comprehensive usage documentation and test suite Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Added LoRA (Low-Rank Adaptation) support for parameter-efficient fine-tuning. This feature significantly reduces the number of trainable parameters through low-rank decomposition, enabling efficient fine-tuning of large models.
Changes
New Features
LoRA Infrastructure (
infini_train/include/nn/lora/):lora_config.h/cc- LoRA configuration (rank, alpha, dropout)lora_linear.h/cc- LoRA linear layer wrapperlora_model.h/cc- Multi-LoRA layer managementlora_parallel_linear.h/cc- Tensor parallelism supportlora_utils.h/cc- Utility functionsTests:
test/lora/test_lora.cc- Unit testsDocumentation:
docs/lora_usage.md- Usage documentationExamples:
example/gpt2/main.cc- Added LoRA training exampleBuild:
CMakeLists.txt- Added test_lora build targetTechnical Details
LoRA adds trainable low-rank adapters to frozen model weights: