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