Skip to content

[Bug] Cosmos AdaLayerNorm autocast hardcodes device_type="cuda", breaking on non-CUDA accelerators #1816

Description

@li-lizhe

Problem

and in wrap the LayerNorm in a hardcoded CUDA autocast context:

only disables autocast for CUDA tensors. On other accelerators (Ascend NPU, MPS, XPU, ROCm) the autocast context does not apply, so the norm may be computed in the wrong precision (e.g. bf16) instead of the intended fp32, which can cause numerical differences or dtype mismatches downstream. It also hardcodes a CUDA-specific assumption.

Expected

Disable autocast for the tensor’s actual device: . This is device-agnostic and works on NPU/MPS/XPU/CUDA alike (verified: is valid).

Environment

  • repo: hao-ai-lab/FastVideo
  • device: Ascend 910B (torch.accelerator.current_accelerator() == npu)

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

    installationInstallation and setup issuesplatformPlatform-specific (Windows/macOS)scope: modelModel architecture (DiTs, encoders, VAEs)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions