-
Notifications
You must be signed in to change notification settings - Fork 523
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
Adds validation loss to LoRA fine tune single device #2238
Open
MaxFrax
wants to merge
13
commits into
pytorch:main
Choose a base branch
from
MaxFrax:add_validation_loss_lora_singledevice
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e1a0b23
Adds validation loss to LoRA fine tune single device
MaxFrax ef80846
Fixes execution without validation set
MaxFrax df8cd1e
Moves validate to separate method; adds call after n steps and early …
bc58767
Merge remote-tracking branch 'origin/main' into add_validation_loss_l…
MaxFrax c112537
Merge branch 'add_validation_loss_lora_singledevice' of https://githu…
MaxFrax 555b670
Removes duplicate if
MaxFrax 2ac741e
Removes always true check
MaxFrax 61ac4f6
Groups all validation config under the validation key
MaxFrax 9ba8832
Validation run frequency expressed in epochs instead of steps to user
MaxFrax 1c35995
Fixes wrong arguments behaviours
MaxFrax a51c0ff
Fixes indexing issues and makes tqdm more readable
MaxFrax 05efbcb
Adds validation set configuration to 1B_lora_single_device
MaxFrax 073af72
Removes logging val loss for all batches
MaxFrax File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
usually we want to set the model to .eval mode, because some layers have different behavior, like dropout.
By doing that, we then require less memory, because we only need the forward pass, which allows us to have a higher batch_size --> faster validation step.
I am not sure about the implications it may have to compile/FSDP. For example, compile will have to create a new graph that doesnt require grad, so compile time will have to increase. If the number of graph breaks increase, we may have to manually change the threshold of maximum number of graph breaks. (there is an example of that in one of our RL recipes)
IMO, if you have access to >1 GPU, I would encourage you to implement it in lora_distributed with QLoRA config, add .eval(), run it:
If nothing breaks, I would feel more confident in approving it
Ps: we would also have to add mode.train() in the training loop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@felipemello1 Thanks for the detailed breakdown and suggestions. Should we also unload the model being trained before loading the eval one? Having just one in memory would allow for bigger batch sizes.
That said, I’m currently constrained on time and not very familiar with the implementation details for this. If I were to take this on, it would likely take me a significant amount of time to get it done properly.
Would you be able to take the lead on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @MaxFrax , completely understandable. Thanks for sharing it.
I dont think that I will have bandwidth soon, but if i do, this PR is a good start.
@Ankur-singh , cc'ing you in case you are looking for more issues to contribute to! :D
Thank you guys!