Skip to content

[BUG] About the CPU gradient dtype #5

@arminzhu

Description

@arminzhu

This is caused by a dtype mismatch between p_cpu.grad and torch.empty_like(grad_view, device='cpu'). Perhaps we should fix it to torch.empty_like(grad_view, dtype=p_cpu.grad.dtype, device='cpu').

File "/home/armin/MegaTrain/infinity/model/cpu_master.py", line 810, in _grad_worker p_cpu.grad = torch.empty_like(grad_view, device='cpu') ^^^^^^^^^^ RuntimeError: attempting to assign a gradient with dtype 'c10::BFloat16' to a tensor with grad_dtype 'Float'. The gradient must match the tensor's grad_dtype (defaults to the tensor's dtype).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions