Skip to content
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

[Tests] Improve unet / vae tests #1018

Merged
merged 12 commits into from
Oct 28, 2022
Merged

[Tests] Improve unet / vae tests #1018

merged 12 commits into from
Oct 28, 2022

Conversation

patrickvonplaten
Copy link
Contributor

@patrickvonplaten patrickvonplaten commented Oct 27, 2022

Add aggressive unet, vae single-forward tests with 1e-4 precision.

Using parameterized tests over seeds and timesteps.

@anton-l I'd say we see whether precision holds over the next days (weekend) and then we eventually adapt next week.

@patil-suraj @pcuenca @anton-l - note that tests are now automatically suffixed with _{0, 1, 2, 4} when using parameterized => this makes it slightly more unreadable/useable when running locally, e.g.:

tests/models/test_models_unet_2d.py::UNet2DConditionModelIntegrationTests::test_compvis_sd_inpaint_0 PASSED
tests/models/test_models_unet_2d.py::UNet2DConditionModelIntegrationTests::test_compvis_sd_inpaint_1 PASSED
tests/models/test_models_unet_2d.py::UNet2DConditionModelIntegrationTests::test_compvis_sd_inpaint_2 PASSED
tests/models/test_models_unet_2d.py::UNet2DConditionModelIntegrationTests::test_compvis_sd_inpaint_3 PASSED

@patrickvonplaten patrickvonplaten changed the title [Tests] Improve tests [Tests] Improve unet / vae tests Oct 27, 2022
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Oct 27, 2022

The documentation is not available anymore as the PR was closed or merged.

@patrickvonplaten
Copy link
Contributor Author

Slow tests currently don't work on CPU because of: huggingface/accelerate#796

Think that's fine as they are only run on GPU anyways - device_map="auto" speeds up init from ~25seconds to ~3seconds so this does make a big difference for overall testing - cc @anton-l

Copy link
Member

@anton-l anton-l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really like this solution, thank you! I'll run these on different machines once merged, to hopefully add some datapoints for us

1 Outdated
@@ -19,9 +19,10 @@

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like accidental renaming here, tests/test_models_vae.py → 1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@@ -397,7 +355,7 @@ def test_from_pretrained_hub(self):

@slow
def test_output_pretrained_ve_mid(self):
model = UNet2DModel.from_pretrained("google/ncsnpp-celebahq-256")
model = UNet2DModel.from_pretrained("google/ncsnpp-celebahq-256", device_map="auto")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to see "auto" helping the latency!

)
@require_torch_gpu
def test_compvis_sd_v1_4_fp16(self, seed, timestep, expected_slice):
pass
Copy link
Member

@anton-l anton-l Oct 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it meant to be skipped for now? 4 more passes in the tests below too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ups

@patrickvonplaten patrickvonplaten merged commit a80480f into main Oct 28, 2022
@patrickvonplaten patrickvonplaten deleted the improve_tests branch October 28, 2022 11:43
PhaneeshB pushed a commit to nod-ai/diffusers that referenced this pull request Mar 1, 2023
yoonseokjin pushed a commit to yoonseokjin/diffusers that referenced this pull request Dec 25, 2023
* improve tests

* up

* finish

* upload

* add init

* up

* finish vae

* finish

* reduce loading time with device_map

* remove device_map from CPU

* uP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants