MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / _client_optimizer_needs_remap

Function _client_optimizer_needs_remap

deepspeed/runtime/engine.py:228–237  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

226
227
228def _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
240def _offload_device(offload_config):

Calls

no outgoing calls

Tested by

no test coverage detected