Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

Transformer2D initializing #82

Open
johnmullan opened this issue Jul 2, 2023 · 1 comment
Open

Transformer2D initializing #82

johnmullan opened this issue Jul 2, 2023 · 1 comment

Comments

@johnmullan
Copy link

johnmullan commented Jul 2, 2023

More of a question really, but do you know why the num_attention_heads and attention_head_dim are opposite when initialising Transformer2D blocks?

https://github.com/ExponentialML/Text-To-Video-Finetuning/blob/79e13d17167f66f424a8acad88e83fc76d6d210d/models/unet_3d_blocks.py#L286C17-L286C35

It is opposite in unit_2d_blocks.py
https://github.com/huggingface/diffusers/blob/5439e917cacc885c0ac39dda1b8af12258e6e16d/src/diffusers/models/unet_2d_blocks.py#L872

@johnmullan johnmullan reopened this Jul 2, 2023
@JCBrouwer
Copy link
Contributor

Diffusers defines it in terms of number of attention heads:

num_attention_heads,
out_channels // num_attention_heads,
in_channels=out_channels,

This repo uses number of channels per head:

in_channels // attn_num_head_channels,
attn_num_head_channels,
in_channels=in_channels,

Given that in_channels == out_channels these two are identical.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants