Uh oh!
There was an error while loading. Please reload this page.
Add converter method for ip adapters - #6150
Conversation
HuggingFaceDocBuilderDev
commented
Dec 12, 2023
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
Dec 15, 2023
can we maybe keep this function on the same file? |
fabiorigano
commented
Dec 15, 2023
| if hasattr(self, "peft_config"): | ||
| self.peft_config.pop(adapter_name, None) | ||
| def _convert_ip_adapter_to_diffusers(self, state_dict): |
There was a problem hiding this comment.
| def_convert_ip_adapter_to_diffusers(self, state_dict): | |
| def_convert_ip_adapter_image_proj_to_diffusers(self, state_dict): |
There was a problem hiding this comment.
I wonder if we should move this method to https://github.com/huggingface/diffusers/blob/main/src/diffusers/loaders/ip_adapter.py. This way the UNet loader stays cleaner.
| else: | ||
| new_sd[k] = v | ||
| new_sd = self._convert_ip_adapter_to_diffusers(image_proj_state_dict) |
There was a problem hiding this comment.
can we have this function return the image_projection module instead?
| new_sd = self._convert_ip_adapter_to_diffusers(image_proj_state_dict) | ||
| image_projection.load_state_dict(new_sd) |
| ) | ||
| image_projection.load_state_dict(image_proj_state_dict) | ||
| del image_proj_state_dict | ||
| new_sd = self._convert_ip_adapter_to_diffusers(image_proj_state_dict) |
There was a problem hiding this comment.
| new_sd=self._convert_ip_adapter_to_diffusers(image_proj_state_dict) | |
| new_sd=self._convert_ip_adapter_image_proj_to_diffusers(image_proj_state_dict) |
| ) | ||
| image_projection.load_state_dict(image_proj_state_dict) | ||
| del image_proj_state_dict | ||
| new_sd = self._convert_ip_adapter_to_diffusers(image_proj_state_dict) |
There was a problem hiding this comment.
| new_sd=self._convert_ip_adapter_to_diffusers(image_proj_state_dict) | |
| new_sd=self._convert_ip_adapter_image_proj_to_diffusers(image_proj_state_dict) |
patrickvonplaten
left a comment
There was a problem hiding this comment.
Ok to merge for me once @yiyixuxu is happy with it
fabiorigano
commented
Dec 19, 2023
@yiyixuxu@sayakpaul@patrickvonplaten thank you for your time and digging into the code :) |
* Add converter method for ip adapters * Move converter method * Update to image proj converter --------- Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
* Add converter method for ip adapters * Move converter method * Update to image proj converter --------- Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
* Add converter method for ip adapters * Move converter method * Update to image proj converter --------- Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>
What does this PR do?
Fixes5915 (comment)
Before submitting
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
@patrickvonplaten