Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add self.use_ada_layer_norm_* params back to BasicTransformerBlock #6841

Merged
merged 1 commit into from
Feb 4, 2024

Conversation

yiyixuxu
Copy link
Collaborator

@yiyixuxu yiyixuxu commented Feb 4, 2024

fix #6838

I also fixed some other error in the sd reference community pipelines while I'm at it (so also fix #5028 (comment))

we should deprecate these params too

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

@@ -538,7 +538,7 @@ def hack_CrossAttnDownBlock2D_forward(

return hidden_states, output_states

def hacked_DownBlock2D_forward(self, hidden_states, temb=None):
def hacked_DownBlock2D_forward(self, hidden_states, temb=None, **kwargs):
Copy link
Member

Choose a reason for hiding this comment

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

Why is kwargs needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

hacked_DownBlock2D_forward is a function they wrote to replace the forward method of the DownBlock2D ,hence the signature has to match. We added a new argument scale for the lora refactor and causes an error here without **kwargs

I think they should write their custom blocks instead

@@ -634,7 +634,9 @@ def hacked_CrossAttnUpBlock2D_forward(

return hidden_states

def hacked_UpBlock2D_forward(self, hidden_states, res_hidden_states_tuple, temb=None, upsample_size=None):
def hacked_UpBlock2D_forward(
self, hidden_states, res_hidden_states_tuple, temb=None, upsample_size=None, **kwargs
Copy link
Member

Choose a reason for hiding this comment

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

Same.

Comment on lines +161 to +165
self.use_ada_layer_norm_zero = (num_embeds_ada_norm is not None) and norm_type == "ada_norm_zero"
self.use_ada_layer_norm = (num_embeds_ada_norm is not None) and norm_type == "ada_norm"
self.use_ada_layer_norm_single = norm_type == "ada_norm_single"
self.use_layer_norm = norm_type == "layer_norm"
self.use_ada_layer_norm_continuous = norm_type == "ada_norm_continuous"
Copy link
Member

Choose a reason for hiding this comment

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

I am okay with this.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry for the late reply. I'd maybe just add a comment to state that they are kept for back-compatibility reasons.

@@ -603,7 +603,9 @@ def hacked_CrossAttnUpBlock2D_forward(

return hidden_states

def hacked_UpBlock2D_forward(self, hidden_states, res_hidden_states_tuple, temb=None, upsample_size=None):
def hacked_UpBlock2D_forward(
self, hidden_states, res_hidden_states_tuple, temb=None, upsample_size=None, **kwargs
Copy link
Member

Choose a reason for hiding this comment

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

Same.

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.

Thanks for the swift action. Just a question.

@yiyixuxu yiyixuxu merged commit a5fc62f into main Feb 4, 2024
16 checks passed
@yiyixuxu yiyixuxu deleted the fix-transformer-block branch February 4, 2024 21:27
sayakpaul pushed a commit that referenced this pull request Feb 6, 2024
#6841)

fix sd reference community ppeline

Co-authored-by: yiyixuxu <yixu310@gmail,com>
AmericanPresidentJimmyCarter pushed a commit to AmericanPresidentJimmyCarter/diffusers that referenced this pull request Apr 26, 2024
huggingface#6841)

fix sd reference community ppeline

Co-authored-by: yiyixuxu <yixu310@gmail,com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants