Args: **inputs: Model inputs, forwarded to ``train_fn`` as keyword arguments and used to trace the joint graph """ifself._compile_started:raiseRuntimeError("GraphCompiler.compile() may only be called once: the ""partitioning passes mutate the live model in place, so ""re-compiling (even after a failed attempt) would trace an ""already-partitioned model"
266267268269270271272273274
# Passes mutate ``graph_module`` in place and return it, so the# transformed graph lives on ``joint_graph`` for ``forward_backward``.# Only the mutating passes make a retry unsafe, so guard from here.self._compile_started=Truepipeline.run(joint_graph.graph_module,**pass_kwargs)ifjoint_graph.input_guardsisnotNone:joint_graph.input_guards.refresh()
427428429430431432433434
self._parameter_groups[name]=(registered[ranks],shard.size())def_mesh_device_type(self)->str:"""Return the backend of the self-built mesh, honoring ``device``."""returntorch.device(self.device).typedef_init_device_mesh(self,mesh_context:Optional[Any]=None):"""Initialize the DP process group(s) for the configured ``dp_mode``.