Skip to content

[do not merge] HunyuanDIT refactor #8290

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

Closed
wants to merge 5 commits into from
Closed

[do not merge] HunyuanDIT refactor #8290

wants to merge 5 commits into from

Conversation

yiyixuxu
Copy link
Collaborator

@yiyixuxu yiyixuxu commented May 27, 2024

part of #8240

to-do:

  • refactor HunyuanDiT2DModel: removed HunyuanDiTPatchEmbed, HunyuanDiTTimestepEmbedder
  • refactor apply_rotary_emb
  • refactor HunyuanDiTBlock : keep it as a Hunyuan-specific block and move to the same file as HunyuanDiT2DModel

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


from typing import Tuple, Union, Optional

class HunyuanDiTAttentionPool(nn.Module):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

moved to hunyuan_transformer_2d.py


A convolution based approach to patchifying a 2D image w/ embedding projection.
class AdaLayerNormShift(nn.Module):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is refactored from default_modulation: can you tell us more about it? Is it part of the AdaLayerNorm family but without the scale? is there a reference? should we move to embeddings.py with other normalization methods?

self.extra_in_dim = 256 * 6 + hidden_size

# Text embedding for `add`
self.pos_embed = PatchEmbed(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I refactored this with our PatchEmbed but we are not actually adding the position embedding here - does it make sense to call it pos_embed still?

 refactor rotary embedding + move dit block to dit model file
@yiyixuxu yiyixuxu closed this May 29, 2024
@yiyixuxu yiyixuxu reopened this May 29, 2024
@yiyixuxu yiyixuxu closed this May 29, 2024
@yiyixuxu yiyixuxu deleted the hunyuan-yiyi-2 branch May 29, 2024 06:12
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.

2 participants