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

bug : cannot trace HDiT in export scripts #728

Open
fchouteau opened this issue Nov 21, 2024 · 0 comments
Open

bug : cannot trace HDiT in export scripts #728

fchouteau opened this issue Nov 21, 2024 · 0 comments

Comments

@fchouteau
Copy link

fchouteau commented Nov 21, 2024

HDiT arch is not traceable,

Fixes :

  1. K_DIFFUSION_USE_COMPILE should be set to 0 at export time in order to bypass the torch.compile ops that can't be traced

models/modules/hdit/flags.py#L9

  1. apply_rotary_embed_ is not traceable models/modules/hdit/hdit.py#L218

However apply_rotary_embed models/modules/hdit/hdit.py#L202

So it should be a matter of monkey patching the two functions at export time :

Example :

def export(opt, cuda, model_in_file, model_out_file, opset_version, export_type):

    model = gan_networks.define_G(**vars(opt))

    if isinstance(model, models.modules.hdit.hdit.HDiT):
        models.modules.hdit.hdit.apply_rotary_emb_ = (
            models.modules.hdit.hdit.apply_rotary_emb
        )

PR should be up in the following days

@fchouteau fchouteau changed the title bug : cannot trace HDiT bug : cannot trace HDiT in export scripts Nov 21, 2024
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