MCPcopy
hub / github.com/huggingface/transformers / is_world_process_zero

Method is_world_process_zero

src/transformers/trainer.py:4420–4429  ·  view source on GitHub ↗

Whether or not this process is the global main process (when training in a distributed fashion on several machines, this is only going to be `True` for one process).

(self)

Source from the content-addressed store, hash-verified

4418 return self.args.local_process_index == 0
4419
4420 def is_world_process_zero(self) -> bool:
4421 """
4422 Whether or not this process is the global main process (when training in a distributed fashion on several
4423 machines, this is only going to be `True` for one process).
4424 """
4425 # Special case for SageMaker ModelParallel since there process_index is dp_process_index, not the global
4426 # process index.
4427 if is_sagemaker_mp_enabled():
4428 return smp.rank() == 0
4429 return self.args.process_index == 0
4430
4431 def _move_model_to_device(self, model: nn.Module, device: torch.device) -> None:
4432 """Move the model to the specified device, re-tying weights on XLA if needed."""

Callers 15

__init__Method · 0.95
init_hf_repoMethod · 0.95
create_model_cardMethod · 0.95
push_to_hubMethod · 0.95
_push_from_checkpointMethod · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
log_metricsFunction · 0.80
save_metricsFunction · 0.80

Calls 1

is_sagemaker_mp_enabledFunction · 0.85

Tested by

no test coverage detected