Skip to content

Conversation

@fabiorigano
Copy link
Contributor

@fabiorigano fabiorigano commented Jan 13, 2024

What does this PR do?

Fixes #6561 and #6192 (comment)

@patrickvonplaten @sayakpaul

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.

thanks!

@yiyixuxu yiyixuxu requested review from DN6 and sayakpaul January 13, 2024 18:44
image_encoder = CLIPVisionModelWithProjection.from_pretrained(
pretrained_model_name_or_path_or_dict,
subfolder=os.path.join(subfolder, "image_encoder"),
subfolder=Path(subfolder, "image_encoder").as_posix(),
Copy link
Member

Choose a reason for hiding this comment

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

It seems to be a good idea to follow this throughout in the library to better support Windows.

What say @patrickvonplaten @yiyixuxu?

Copy link
Member

Choose a reason for hiding this comment

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

Opened a tracker here: #6585.

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.

Very nice PR!

if all(proc.__class__ in ADDED_KV_ATTENTION_PROCESSORS for proc in self.attn_processors.values()):
processor = AttnAddedKVProcessor()
processor = (
AttnAddedKVProcessor2_0() if hasattr(F, "scaled_dot_product_attention") else AttnAddedKVProcessor()
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm I still understand AttnAddedKVProcessor and AttnProcessor really as the default attn processor. This is a bit of a breaking change. Could we maybe move this change out of the PR for now? cc @yiyixuxu @sayakpaul and @DN6 as well

Copy link
Member

Choose a reason for hiding this comment

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

That should be the case indeed. No optimized things as the default.

Copy link
Contributor

@patrickvonplaten patrickvonplaten left a comment

Choose a reason for hiding this comment

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

Hey @fabiorigano,

Super nice fix by using posix()! Could we for now maybe try to focus only on this change and not also mix a change of set_default_attn_processor in this PR ?

@fabiorigano fabiorigano changed the title Fix in IP Adapter and improvement of set_default_attn_processors Fix path generation in IP Adapter Jan 15, 2024
@fabiorigano
Copy link
Contributor Author

Removed changes on set_default_attn_processors!

@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.

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.

Super work here.

@fabiorigano
Copy link
Contributor Author

fabiorigano commented Jan 16, 2024

@sayakpaul just to be sure about the purpose of this fix: os.path.join seem to be working in all the other instances in the library, while it doesn't work when used in .from_pretrained(os.path.join()).

I don't know if it worth it to update all instances in the library

@sayakpaul
Copy link
Member

That is weird. But it's good to follow a convention across the board I think.

@sayakpaul sayakpaul merged commit 23eed39 into huggingface:main Jan 16, 2024
AmericanPresidentJimmyCarter pushed a commit to AmericanPresidentJimmyCarter/diffusers that referenced this pull request Apr 26, 2024
* Fix path generation on Windows

* Update set_default_attn_processors

* Use pathlib

* Fix quality

* Fix copy

* Revert changes in set_default_attn_processors

---------

Co-authored-by: Sayak Paul <[email protected]>
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.

OSError: h94/IP-Adapter does not appear to have a file named models\image_encoder\config.json

5 participants