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

We don't have to encode_text in each denoise timestep (but compute them at the beginning), do we? #151

Open
RalphHan opened this issue Aug 28, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@RalphHan
Copy link

https://github.com/GuyTevet/motion-diffusion-model/blob/8139dda55d90a58aa5a257ebf159b2ecfb78c632/model/mdm.py#L151C8-L151C8

class MDM(nn.Module):
......
    def forward(self, x, timesteps, y=None):
        """
        x: [batch_size, njoints, nfeats, max_frames], denoted x_t in the paper
        timesteps: [batch_size] (int)
        """
        bs, njoints, nfeats, nframes = x.shape
        emb = self.embed_timestep(timesteps)  # [1, bs, d]

        force_mask = y.get('uncond', False)
        if 'text' in self.cond_mode:
            enc_text = self.encode_text(y['text'])
            emb += self.embed_text(self.mask_cond(enc_text, force_mask=force_mask))
@GuyTevet
Copy link
Owner

Yes, that's possible at inference (but not in training) and can accelerate performance. If you are interested, you can send us a pull request.

@RalphHan
Copy link
Author

Yes, that's possible at inference (but not in training) and can accelerate performance. If you are interested, you can send us a pull request.

@GuyTevet I send a PR here: #152

@GuyTevet GuyTevet added the enhancement New feature or request label Aug 29, 2023
@leob03
Copy link

leob03 commented Apr 23, 2024

Why is it not possible during training ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants