(optimizer)
| 73 | |
| 74 | |
| 75 | def is_zero_supported_optimizer(optimizer): |
| 76 | if dist.get_rank() == 0: |
| 77 | logger.info(f'Checking ZeRO support for optimizer={optimizer.__class__.__name__} type={type(optimizer)}') |
| 78 | # Add MuonWithAuxAdam to supported list if muon is installed. This happens here instead of at module level |
| 79 | # because importing Muon compiles its kernels, which slows down import deepspeed. |
| 80 | try: |
| 81 | from deepspeed.runtime.zero.muon.muon_optimizer import MuonWithAuxAdam |
| 82 | if MuonWithAuxAdam not in ZERO_SUPPORTED_OPTIMIZERS: |
| 83 | ZERO_SUPPORTED_OPTIMIZERS.append(MuonWithAuxAdam) |
| 84 | except ImportError: |
| 85 | pass |
| 86 | return type(optimizer) in ZERO_SUPPORTED_OPTIMIZERS |
| 87 | |
| 88 | |
| 89 | @instrument_w_nvtx |
no test coverage detected