diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

[Core] Refactor `IPAdapterPlusImageProjection` a bit

Open sayakpaul opened this issue 1 year ago • 5 comments

What does this PR do?

Refer to https://github.com/huggingface/diffusers/pull/7988/#issuecomment-2120785867, thanks to @fabiorigano for the suggestion. Even though Fabio mentioned working on a PR for this, I had some free-time and thought I would do it. I hope that's okay with you, @fabiorigano?

In any case, would really appreciate your reviews here and if you could test this if you find some time, that would be of great help.

@rootonchair feel free to give it a look as well.

sayakpaul avatar May 21 '24 08:05 sayakpaul

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.

@sayakpaul no problem, it looks really good and neat to me now! I will do some testing as soon as I can, but maybe https://github.com/huggingface/diffusers/blob/e1df77ee1ec0400195ad8dcb2099d137b34c9b9f/tests/models/unets/test_models_unet_2d_condition.py#L114 should be updated too, right?

fabiorigano avatar May 21 '24 11:05 fabiorigano

@sayakpaul I tested both simple inference and the test_ip_adapter_plus function in the test suite with the command python -m pytest -s -v tests/models -k test_ip_adapter_plus. Everything works as expected, even the test because some keys are not updated and the loading process doesn't fail. The following conditions are never true because of the new architecture of the class: https://github.com/huggingface/diffusers/blob/e1df77ee1ec0400195ad8dcb2099d137b34c9b9f/tests/models/unets/test_models_unet_2d_condition.py#L162-L175

IMO they should be either removed or updated. WDYT?

fabiorigano avatar May 21 '24 16:05 fabiorigano

Thanks for catching this, @fabiorigano! I just updated it in 9ebacf3. WDYT?

sayakpaul avatar May 22 '24 06:05 sayakpaul

Looks great! @sayakpaul

fabiorigano avatar May 22 '24 07:05 fabiorigano

Thanks to @fabiorigano once again for the suggestion and kind help.

sayakpaul avatar May 29 '24 01:05 sayakpaul