Skip to content

error: input types 'tensor<2x1280xf32>' and 'tensor<*xf16>' are not broadcast compatible #237

Description

@toffaletti

dream.py crashes with this error on my M1. The original scripts work fine.

I've stepped through with a debugger and traced the problem to this, but I'm a bit out of my area here.
https://github.com/lstein/stable-diffusion/blob/2aa83932728242b05248fada8447506e2fbed9f0/ldm/modules/diffusionmodules/openaimodel.py#L798

ldm/modules/diffusionmodules/openaimodel.py

    def forward(self, x, timesteps=None, context=None, y=None, **kwargs):
        """
        Apply the model to an input batch.
        :param x: an [N x C x ...] Tensor of inputs.
        :param timesteps: a 1-D batch of timesteps.
        :param context: conditioning plugged in via crossattn
        :param y: an [N] Tensor of labels, if class-conditional.
        :return: an [N x C x ...] Tensor of outputs.
        """
        assert (y is not None) == (
            self.num_classes is not None
        ), 'must specify y if and only if the model is class-conditional'
        hs = []
        t_emb = timestep_embedding(
            timesteps, self.model_channels, repeat_only=False
        )
        emb = self.time_embed(t_emb) <----- crashes when stepping into this line
        self.time_embed = nn.Sequential(
            linear(model_channels, time_embed_dim),
            nn.SiLU(),
            linear(time_embed_dim, time_embed_dim),
        )

I am working from this set of changes just to get this far: https://github.com/toffaletti/stable-diffusion/tree/dream-m1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions