Skip to content

Introduce LoraConfig#17229

Open
lucylq wants to merge 2 commits intogh/lucylq/132/basefrom
gh/lucylq/132/head
Open

Introduce LoraConfig#17229
lucylq wants to merge 2 commits intogh/lucylq/132/basefrom
gh/lucylq/132/head

Conversation

@lucylq
Copy link
Contributor

@lucylq lucylq commented Feb 5, 2026

Differential Revision: [D92304723](https://our.internmc.facebook.com/intern/diff/D92304723/)

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Feb 5, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/17229

Note: Links to docs will display an error until the docs builds have been completed.

❌ 3 New Failures, 2 Unrelated Failures

As of commit 9876e7d with merge base eac0673 (image):

NEW FAILURES - The following jobs have failed:

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 5, 2026
@github-actions
Copy link

github-actions bot commented Feb 5, 2026

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@lucylq lucylq changed the title Introduce LoraConfig [wip] Introduce LoraConfig Feb 5, 2026
@lucylq lucylq changed the title [wip] Introduce LoraConfig Introduce LoraConfig Feb 5, 2026
@lucylq lucylq requested a review from Copilot February 5, 2026 19:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a LoraConfig dataclass to encapsulate LoRA (Low-Rank Adaptation) adapter configuration, replacing the previous separate adapter_checkpoint and adapter_config fields in BaseConfig. This refactoring improves code organization and provides a cleaner API for LoRA configuration.

Changes:

  • Added LoraConfig dataclass with validation and automatic config parsing from JSON
  • Refactored BaseConfig to use LoraConfig instead of separate adapter fields
  • Updated from_args method to create LoraConfig instances from CLI arguments
  • Simplified adapter loading logic in Llama2Model by using the new LoraConfig object

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
extension/llm/export/config/llm_config.py Introduces LoraConfig dataclass with validation, updates BaseConfig to use it, and modifies from_args to create LoraConfig from CLI arguments
examples/models/llama/model.py Refactors adapter loading to use LoraConfig object, simplifying the logic by removing redundant validation and JSON parsing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +112 to +114
import json
import os

Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

Remove these duplicate imports. The modules json and os are already imported at the top of the file (lines 21-22), so importing them again inside this method is unnecessary.

Suggested change
import json
import os

Copilot uses AI. Check for mistakes.
"""

import argparse
import json
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

Import of 'json' is not used.

Suggested change
import json

Copilot uses AI. Check for mistakes.

import argparse
import json
import os
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

Import of 'os' is not used.

Suggested change
import os

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant