Skip to content

Conversation

@fabiorigano
Copy link
Contributor

What does this PR do?

Image masking is currently supported by passing a mask and an image for each IP Adapter in the pipeline.

This PR extends this usage by allowing multiple masks and images to be passed to a single IP Adapter. Scales must be passed accordingly.

Discussed in #7419

@sayakpaul @yiyixuxu

@fabiorigano fabiorigano changed the title [WIP] Multi-image support for single IP Adapter [WIP] Multi-image masking for single IP Adapter Mar 27, 2024
Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

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

Changes looking nice ❤️ Great work as always. Let's add a fast test and see how it goes?

@HuggingFaceDocBuilderDev

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.

@fabiorigano
Copy link
Contributor Author

thank you @sayakpaul

ready

@fabiorigano fabiorigano changed the title [WIP] Multi-image masking for single IP Adapter Multi-image masking for single IP Adapter Mar 31, 2024
max_diff = numpy_cosine_similarity_distance(image_slice, expected_slice)
assert max_diff < 5e-4

def test_ip_adapter_multiple_masks_one_adapter(self):
Copy link
Member

Choose a reason for hiding this comment

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

This is slow test. I was wondering if it's possible to add a fast test like

def test_ip_adapter_single(self, expected_max_diff: float = 1e-4, expected_pipe_slice=None):

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see, I missed that

I'll add it now

@DN6 DN6 requested a review from yiyixuxu April 1, 2024 07:21
Copy link
Collaborator

@yiyixuxu yiyixuxu left a comment

Choose a reason for hiding this comment

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

thank you for working on this!
looks good. I left some feedbacks. let's make very clear what's the expected shape for ip_adapter_mask and scale

@fabiorigano
Copy link
Contributor Author

@yiyixuxu @sayakpaul now it's ready
thanks for your reviews

Copy link
Collaborator

@yiyixuxu yiyixuxu left a comment

Choose a reason for hiding this comment

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

looks good to me!
I will run slow tests to make sure it does not break anything before merge

@yiyixuxu yiyixuxu self-assigned this Apr 8, 2024
@yiyixuxu yiyixuxu mentioned this pull request Apr 8, 2024
@fabiorigano
Copy link
Contributor Author

thank you YiYi!

I fixed the fast test for the panorama pipeline that was failing and the slow test

I ran all the slow tests related to image masking locally and they didn't break :)

@yiyixuxu yiyixuxu merged commit a0cf607 into huggingface:main Apr 9, 2024
@fabiorigano fabiorigano deleted the multiimageipmask branch April 9, 2024 19:21
sayakpaul added a commit that referenced this pull request Dec 23, 2024
* Support multiimage masking

---------

Co-authored-by: Sayak Paul <[email protected]>
Co-authored-by: YiYi Xu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants