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
Add trainer integration test for llava to ensure accelerate autocasting works correctly #30489
base: main
Are you sure you want to change the base?
Add trainer integration test for llava to ensure accelerate autocasting works correctly #30489
Conversation
@@ -0,0 +1,120 @@ | |||
import unittest |
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.
This file should be the only new change. That will be clearer once the other is merged. Usually I would set it up to merge this one into the first but this feels a bit difference since the changes are on a fork.
b723f1f
to
908ff93
Compare
|
||
output = model(**inputs) | ||
expected_slice = torch.tensor( | ||
[[-3.5664, -3.5625, -0.4309], [-5.8242, -5.6914, -1.3242], [-5.4805, -5.9375, 1.1465]], |
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.
I saw this pattern in the llava next tests. These came from the use of this model before training. Not quite sure if this is correct so please let me know if there is something else we want to test. Perhaps instead we want the trained model before applying the downcasting change?
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.
Also note these do not yet pass allclose
. I wanted to go ahead and open this PR to generate discussion around what the right thing to test is.
"llava-hf/bakLlava-v1-hf", quantization_config=bits_and_bytes_config | ||
) | ||
adapter_name = "lora_default" | ||
peft_config = LoraConfig( |
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.
I am somewhat unclear on where we test the slow tests but I assume there is some limit on memory so I tried to give a reasonable LORA for this test. If you think there is a simpler or more idiomatic way to do this test please let me know.
908ff93
to
1cd13e0
Compare
@slow | ||
@require_bitsandbytes | ||
def test_model_trainer_integration_test(self): | ||
def image_prompt_generator(): |
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.
Not entirely sure this is the simplest or most idiomatic way to create this test dataset so please let me know if there is a better way.
7ce15e3
to
9440dd6
Compare
cc @muellerzr for first review |
9440dd6
to
e9e3feb
Compare
e9e3feb
to
bc31529
Compare
Updated this now that the previous PR is merged! I am very concerned about OOMs being an issue here however. I think there's some open questions around:
|
8f35687
to
3c7e7e1
Compare
What does this PR do?
This PR adds a new integration test to ensure the accelerate autocasting is working correctly. This came out of a discussion found here and that PR should probably be merged first (or this one merged into that one).
Fixes # (issue)
Before submitting
Pull Request section?
to it if that's the case.
Not an issue but another PR that should probably be merged first: Fix llava half precision and autocast issues #29721 (comment)
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.