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

Function _client_optimizer_needs_remap

deepspeed/runtime/engine.py:229–238  ·  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

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

Calls

no outgoing calls

Tested by

no test coverage detected