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

How to implement IPAdapterAttnProcessor2_0 with xformers #7957

Closed
JWargrave opened this issue May 16, 2024 · 1 comment
Closed

How to implement IPAdapterAttnProcessor2_0 with xformers #7957

JWargrave opened this issue May 16, 2024 · 1 comment

Comments

@JWargrave
Copy link

I want to fine-tune IP-adapter model with xformers, but I did not find the implementation of the xformers version corresponding to IPAdapterAttnProcessor2_0. I want to implement attention processor in xformers, are the following two lines of code the only difference between the two versions?

In XFormersAttnProcessor:

hidden_states = xformers.ops.memory_efficient_attention(
    query, key, value, attn_bias=attention_mask, op=self.attention_op, scale=attn.scale
)

In AttnProcessor2_0:

hidden_states = F.scaled_dot_product_attention(
    query, key, value, attn_mask=attention_mask, dropout_p=0.0, is_causal=False
)
@JWargrave
Copy link
Author

I have found the answer

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

No branches or pull requests

1 participant