Guest User

Untitled

a guest
Aug 14th, 2025
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. just do some shit like that and you should be fine:
  2.  
  3. try:
  4. import torch.distributed as dist
  5. HAS_DIST = True
  6. except ImportError:
  7. HAS_DIST = False
  8. dist = None
  9.  
  10. # In your Muon step() method:
  11. if HAS_DIST and dist.is_available() and dist.is_initialized():
  12. # distributed training path
  13. # ... distributed logic here
  14. else:
  15. # single device path - just process parameters normally
  16. for p in group["params"]:
  17. if p.grad is None:
  18. continue
  19. # apply muon update directly without dist.all_gather
Advertisement
Add Comment
Please, Sign In to add comment