torchtune
torchtune copied to clipboard
Add LoRA and QLoRA Components, Models, and Configs for Phi3 Mini
Context
What is the purpose of this PR? Is it to
- [x] add a new feature
- [ ] fix a bug
- [ ] update tests and/or documentation
- [ ] other (please add here)
Please link to any issues this PR addresses.
Changelog
This PR extends the Phi3 Mini PR by adding the lora_phi3 class as well as lora_phi3_mini and qlora_phi3_mini model builders. This PR also introduces a new recipe configs: mini_lora, mini_lora_single_device, and mini_qlora_single_device.
Test plan
Please make sure to do each of the following if applicable to your PR. (If you're not sure about any one of these just ask and we will happily help.)
- [x] run pre-commit hooks and linters (make sure you've first installed via
pre-commit install
) - [x] add unit tests for any new functionality
- [ ] update docstrings for any new or updated methods or classes
- [x] run unit tests via
pytest tests
- [x] run recipe tests via
pytest tests -m integration_test
- [x] manually run any new or modified recipes with sufficient proof of correctness
- [x] include relevant commands and any other artifacts in this summary (pastes of loss curves, eval results, etc.)
New Unit tests: Added a unit test for phi3 and for lora and qlora phi3 mini. These tests are a port of the llama2 tests. New configs: The 3 new configs so far are based off of llama2 and phi2 values. 1 epoch of training is being done now with:
tune run --nnodes 1 --nproc_per_node 2 lora_finetune_distributed --config phi3/mini_lora
tune run lora_finetune_single_device --config phi3/mini_qlora_single_device
tune run lora_finetune_single_device --config phi3/mini_lora_single_device
After runs are completed, this readme will be updated with loss and eval
:link: Helpful Links
:test_tube: See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/torchtune/932
- :page_facing_up: Preview Python docs built from this PR
Note: Links to docs will display an error until the docs builds have been completed.
:white_check_mark: No Failures
As of commit 2823b42747e4257cc6e02f033220c6860986e265 with merge base fa1392b08598202971a3afd291ec50bc35ceb342 ():
:green_heart: Looks good so far! There are no failures yet. :green_heart:
This comment was automatically generated by Dr. CI and updates every 15 minutes.
Codecov Report
Attention: Patch coverage is 98.91304%
with 2 lines
in your changes are missing coverage. Please review.
Project coverage is 66.14%. Comparing base (
a978956
) to head (c4ca183
). Report is 26 commits behind head on main.
Files | Patch % | Lines |
---|---|---|
tests/torchtune/models/phi3/test_lora_phi3.py | 99.15% | 1 Missing :warning: |
torchtune/models/phi3/_model_builders.py | 80.00% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #932 +/- ##
==========================================
- Coverage 66.39% 66.14% -0.26%
==========================================
Files 155 171 +16
Lines 6484 7165 +681
==========================================
+ Hits 4305 4739 +434
- Misses 2179 2426 +247
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Actually approved now. Thanks @pbontrager