def forward(self, x: torch.Tensor):
        """Apply LayerNorm and preserve the input dtype."""
        orig_type = x.dtype
        ret = super().forward(x)
        return ret.type(orig_type)
Apply LayerNorm and preserve the input dtype.
examples/community/pipeline_faithdiff_stable_diffusion_xl.py