Whether ``optimizer`` is one that module replacement can invalidate. A config-built or callable optimizer is constructed after the replacement and needs neither the source map nor the remap. Both the map construction in ``_configure_expert_parallel`` -- which keeps the discarded pre-sha
(optimizer)
| 226 | |
| 227 | |
| 228 | def _client_optimizer_needs_remap(optimizer): |
| 229 | """Whether ``optimizer`` is one that module replacement can invalidate. |
| 230 | |
| 231 | A config-built or callable optimizer is constructed after the replacement and needs neither |
| 232 | the source map nor the remap. Both the map construction in ``_configure_expert_parallel`` -- |
| 233 | which keeps the discarded pre-shard expert weights alive until the remap is done -- and the |
| 234 | remap itself key off this one predicate, so the two cannot drift apart and silently leave |
| 235 | the remap a no-op. |
| 236 | """ |
| 237 | return optimizer is not None and hasattr(optimizer, "param_groups") |
| 238 | |
| 239 | |
| 240 | def _offload_device(offload_config): |
no outgoing calls
no test coverage detected