Conversation
|
|
||
|
|
||
| @require_torch_accelerator | ||
| @require_read_token |
There was a problem hiding this comment.
we can use this at class level now
| @classmethod | ||
| def tearDownClass(cls): | ||
| del cls._model | ||
| cleanup(torch_device, gc_collect=True) |
There was a problem hiding this comment.
we should delete class attributes that containing models at the end
There was a problem hiding this comment.
Oh woww for sure! IMO it's super bad practice to add it as a class attribute, can we switch it to instance attribute in setUpClass maybe? That should avoid several potential pitfalls, and we should not need tearDownCLass anymore I think (object should be cleaned up automatically)
| def setUp(self): | ||
| self.model_dtype = torch.float16 | ||
| self.tokenizer = AutoTokenizer.from_pretrained(self.model_name, use_fast=False) | ||
| cleanup(torch_device, gc_collect=True) |
There was a problem hiding this comment.
After #33657, we get GPU OOM on T4 for the 2 tests in this test class.
It could be fixed by adding cleanup here, but maybe it's better to see if this is somehow a regression (I think it's probably not a serious issue however). cc @Cyrilvallez
You can reproduce (on T4) by running
HF_HUB_READ_TOKEN=xxx RUN_SLOW=1 python3 -m pytest -v tests/models/mistral/test_modeling_mistral.py::MistralIntegrationTest tests/models/mistral/test_modeling_mistral.py::Mask4DTestHard
There was a problem hiding this comment.
Is that affected by assisted decoding or the link is wrong?
There was a problem hiding this comment.
There was a problem hiding this comment.
It's weird that we need this in setUp when we already have it in tearDown anyway 🤔 It is still the case when moving the model to instance attr instead of class attr?
There was a problem hiding this comment.
ok, for future reference:
it's not very clear, but the extra cleanup added in setup is necessary to avoid OOM if the test test_speculative_generation is failing (due to mismatching of outputs). If it was passing, we don't need this extra cleanup.
I just want to avoid this kind of OOM even some other tests are failing, so better to always have a pair of cleanup
| @slow | ||
| def test_speculative_generation(self): | ||
| EXPECTED_TEXT_COMPLETION = "My favourite condiment is 100% ketchup. I love it on everything. I’m not a big" | ||
| EXPECTED_TEXT_COMPLETION = "My favourite condiment is 100% Sriracha. I love it on everything. I have it on my" |
There was a problem hiding this comment.
always failing up to now
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
| ("cuda", 7): 'The image features two tabby cats lying on a pink surface, which appears to be a couch or', | ||
| ("cuda", 8): 'The image features two cats lying on a pink surface, which appears to be a couch or a bed', |
There was a problem hiding this comment.
In #37882 These values are not updated, but I remembered I checked them on CI runners.
From CI reports, it looks like we get different outputs every day, but I can't reproduce that: I ran them several times and even trigger via workflow runs, all give the same results now (and passing with the updated values).
TODO: monitor in the next few days to see if we get them passing.
There was a problem hiding this comment.
well, I again different values today v.s. the one I get yesterday, wtf .... 😭
There was a problem hiding this comment.
I will revert the changes on mistral3 and dive into them in a separate PR.
Let's keep this PR only for mistral
There was a problem hiding this comment.
hm, maybe we can set_seed or the order of test-cases matters because we use the same cls.model?
There was a problem hiding this comment.
the order of tests here is the same (unless we add , remove or skip some tests).
It seems to me that, only if I rebuild the docker image, we will see the outputs change. If I use the same docker image built, no matter how I run (manually in SSH runners or trigger by GitHub Actions), they all give the same outputs.
I am still checking
There was a problem hiding this comment.
@zucchini-nlp if you ever want to hear this sad sorry (at least for me)
https://huggingface.slack.com/archives/C01NE71C4F7/p1750885359361689
| {"type": "image", "url": "https://huggingface.co/ydshieh/kosmos-2.5/resolve/main/view.jpg"}, | ||
| { | ||
| "type": "image", | ||
| "url": "https://huggingface.co/datasets/hf-internal-testing/testing-data-mistral3/resolve/main/view.jpg", |
There was a problem hiding this comment.
just move the files to a better hub repository
|
run-slow: mistral, mistral3 |
|
This comment contains run-slow, running the specified jobs: models: ['models/mistral', 'models/mistral3'] |
| ("cuda", 7): 'The image features two tabby cats lying on a pink surface, which appears to be a couch or', | ||
| ("cuda", 8): 'The image features two cats lying on a pink surface, which appears to be a couch or a bed', |
There was a problem hiding this comment.
hm, maybe we can set_seed or the order of test-cases matters because we use the same cls.model?
| def setUp(self): | ||
| self.model_dtype = torch.float16 | ||
| self.tokenizer = AutoTokenizer.from_pretrained(self.model_name, use_fast=False) | ||
| cleanup(torch_device, gc_collect=True) |
There was a problem hiding this comment.
Is that affected by assisted decoding or the link is wrong?
|
run-slow: mistral3 |
|
This comment contains run-slow, running the specified jobs: models: ['models/mistral3'] |
Cyrilvallez
left a comment
There was a problem hiding this comment.
Hey! In general, I think that we should abslutely avoid models as class attributes, as it will lead to many many potential issues! Not sure why it was added as class attribute without proper cleanup before, but I'd like to revert this if possible 🤗
| @classmethod | ||
| def tearDownClass(cls): | ||
| del cls._model | ||
| cleanup(torch_device, gc_collect=True) |
There was a problem hiding this comment.
Oh woww for sure! IMO it's super bad practice to add it as a class attribute, can we switch it to instance attribute in setUpClass maybe? That should avoid several potential pitfalls, and we should not need tearDownCLass anymore I think (object should be cleaned up automatically)
| def setUp(self): | ||
| self.model_dtype = torch.float16 | ||
| self.tokenizer = AutoTokenizer.from_pretrained(self.model_name, use_fast=False) | ||
| cleanup(torch_device, gc_collect=True) |
There was a problem hiding this comment.
It's weird that we need this in setUp when we already have it in tearDown anyway 🤔 It is still the case when moving the model to instance attr instead of class attr?
|
run-slow: mistral3 |
|
This comment contains run-slow, running the specified jobs: models: ['models/mistral3'] |
What does this PR do?
Mostly update expected values and use
cleanupto avoid OOM.See some details in a few comments.