Skip to content

[WIP] Full fine-tune and LoRA fine-tune simplifications #2780

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

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Andrei-Aksionov
Copy link

Hey there 👋

Note

This is an implentation for the idea proposed in #2779

This is an implementation of my comment back from March.

The objective is to enhance the maintainability and, in certain aspects, the readability of recipes.

If we consider the differences between a full fine-tuning and LoRA variant, the primary distinctions should lie in:

  1. The way a model is instantiated
  2. The way a checkpoint is saved

This draft/PR proposes precisely this:

  1. Utilizing the full fine-tuning recipe as a foundation
  2. Overriding only the LoRA-specific methods

This approach offers several advantages:

  1. More maintainable code: eliminating the need for identical modifications across multiple locations.
  2. Up-to-date code: sometimes changes made to the full version may not have been incorporated into the LoRA variant.
  3. More readable code: facilitating a clearer understanding of the unique aspects of LoRA fine-tuning (in terms of the recipe) for anyone interested in exploring it.

However, there are a few drawbacks to consider:

  1. Increased readability challenges: while the single-file approach allows users to read the whole recipe as a single file, this approach requires opening two files (ideally side-by-side) to read the recipe.
  2. Reduced hackability: if someone intends to use the LoRA recipe as a starting point and subsequently build upon it, the first two files must be merged. This process is straightforward, as methods need to be replaced as a whole, requiring minimal mental effort and taking a few minutes at most.

As with any solution, it has its own set of drawbacks. Despite these disadvantages, this approach may still be worthwhile.

Copy link

pytorch-bot bot commented Jun 2, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/torchtune/2780

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

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

@facebook-github-bot facebook-github-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 Jun 2, 2025
@Andrei-Aksionov Andrei-Aksionov marked this pull request as draft June 2, 2025 19:40
@Andrei-Aksionov Andrei-Aksionov changed the title Full lora recipy simplification [WIP] Full fine-tune and LoRA fine-tune simplifications Jun 3, 2025
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants