Uh oh!
There was an error while loading. Please reload this page.
IPAdapterTesterMixin - #6862
Conversation
Uh oh!
There was an error while loading. Please reload this page.
HuggingFaceDocBuilderDev
commented
Feb 5, 2024
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. |
yiyixuxu
commented
Feb 5, 2024
thanks so much for working on this!!! 😇😇😇 |
a-r-r-o-w
commented
Feb 6, 2024
Yes that makes sense since Btw, am I right in assuming that IP-Adapter-Plus tests should also be added here? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I think we should add to all pipeline that support ip-adapter; but we should only use IP adapter image embedding directly, so the code addition to the fast tests is actually minimum; I think you just have to append the mixin to the test that's all :) also if we do it that way, we don't test the part of code that's redundant ( |
Co-authored-by: YiYi Xu <yixu310@gmail.com>
Co-authored-by: YiYi Xu <yixu310@gmail.com>
Uh oh!
There was an error while loading. Please reload this page.
yiyixuxu
commented
Feb 9, 2024
look, it already caught a bunch of test failures!!! 😅 Not all of the pipelines need to have ip-adapter support IMO. So if the pipeline isn't very much used, e.g. stable diffusion safe, and the test failure is because the ip-adapter isn't correctly implemented. Let me know! we can probably remove it |
Thanks for the Good PR label 😆 Just adding the IPAdapterTesterMixin to the class defintion was quite convenient! Also quite cool to see the error logs 👀 Will fix in a bit I agree with removing the tests from the not-so-used pipelines that are not regularly discussed about in issues. I will remove them from what I think are lesser used, but since you have access to make changes to my branch, please feel free to change it to your liking. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Pipelines that have the error that looks something like: FAILEDtests/pipelines/controlnet/test_controlnet_img2img.py::ControlNetImg2ImgPipelineFastTests::test_ip_adapter-TypeError: argumentof type 'NoneType'isnotiterableFAILEDtests/pipelines/stable_diffusion/test_stable_diffusion_img2img.py::StableDiffusionImg2ImgPipelineFastTests::test_ip_adapter-TypeError: argumentof type 'NoneType'isnotiterableis because the IP Adapter implementation is added_cond_kwargs= {"image_embeds": image_embeds} ifip_adapter_imageisnotNoneelseNoneThe check should include both ip_adapter_image and ip_adapter_image_embeds as done in some pipelines of #6868 but looks like a few spots were missed. Looks like this mixin will help make things quite consistent! |
Uh oh!
There was an error while loading. Please reload this page.
a-r-r-o-w
commented
Feb 15, 2024
@yiyixuxu I'm not sure why these tests fail. I think the results are slightly different based on device because they do pass on my system with a difference greater than 0.01. Is lowering the threshold the ideal solution or what do you have in mind? Maybe a threshold with the differences accumulated could also be used. Regarding ControlNetSimpleInpaintPipelineFastTests, I'm not sure why the outputs are the same. |
| # forward pass with single ip adapter, but with scale of adapter weights | ||
| inputs = self._modify_inputs_for_ip_adapter_test(self.get_dummy_inputs(torch_device)) | ||
| inputs["ip_adapter_image_embeds"] = [self._get_dummy_image_embeds(cross_attention_dim)] | ||
| pipe.set_ip_adapter_scale(1.0) |
There was a problem hiding this comment.
Maybe increase this value to 100 lol
yiyixuxu
commented
Feb 15, 2024
@a-r-r-o-w |
a-r-r-o-w
commented
Feb 15, 2024
Thanks @yiyixuxu. I believe all tests should pass now and that this is ready for a merge. |
yiyixuxu
commented
Feb 16, 2024
Hi @a-r-r-o-w |
| inputs["output_type"] = "np" | ||
| inputs["return_dict"] = False | ||
| if "image" in inputs.keys(): | ||
| inputs["num_inference_steps"] = 4 |
There was a problem hiding this comment.
Just a question. Why increase this based on the whether image is provided? Because of strength?
There was a problem hiding this comment.
That is correct. The tests fail for img2img tests that have num_inference_steps set to 2 or lower and strength greater than 5. I think if it was:
if"image"ininputs().keys() and"strength"ininputs().keys():
...it would make more sense.
| inputs["num_inference_steps"] = 4 | ||
| return inputs | ||
| def test_ip_adapter(self, expected_max_diff: float = 1e-4): |
There was a problem hiding this comment.
Can we break this up into individually named tests? It is hard to debug when an intermediate assert causes the entire test to fail.
There was a problem hiding this comment.
I've split it into two tests for the time being but note that if we have K classes that derive from this mixin, we now have K additional inferences running as compared to before. The time to execute all tests doesn't increase too much though.
a-r-r-o-w
commented
Feb 16, 2024
Yeah, I think I've been having troubles on getting it to work. I'm not sure why the results vary :/ |
d618540 to
6744cacComparea-r-r-o-w
commented
Feb 18, 2024
@yiyixuxu Apologies for the delay. With the last commit, all tests pass for me locally and I hope this is completed 🥲 |
yiyixuxu
commented
Feb 23, 2024
thank you:) |
What does this PR do?
Adds IPAdapterTesterMixin to ensure pipelines supporting it are not broken with newer changes.
Fixes#6829.
Before submitting
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@yiyixuxu@sayakpaul