MCPcopy
hub / github.com/InternLM/InternLM / get_world_size

Method get_world_size

internlm/core/context/parallel_context.py:323–333  ·  view source on GitHub ↗

Returns the world size for `parallel_mode`. Args: parallel_mode: The chosen parallel mode. Returns: int: The world size for `parallel_mode`.

(self, parallel_mode: ParallelMode)

Source from the content-addressed store, hash-verified

321 return self.is_last_rank(ParallelMode.PIPELINE)
322
323 def get_world_size(self, parallel_mode: ParallelMode):
324 """Returns the world size for `parallel_mode`.
325
326 Args:
327 parallel_mode: The chosen parallel mode.
328
329 Returns:
330 int: The world size for `parallel_mode`.
331 """
332 self._check_parallel_mode(parallel_mode)
333 return self._world_sizes.get(parallel_mode, 1)
334
335 def get_group(self, parallel_mode: ParallelMode):
336 """Returns the group of the current device for `parallel_mode`.

Callers 15

get_next_global_rankMethod · 0.95
get_prev_global_rankMethod · 0.95
is_using_dpMethod · 0.95
is_using_tpMethod · 0.95
is_using_ppMethod · 0.95
is_last_rankMethod · 0.95
init_parallel_groupsMethod · 0.95
mainFunction · 0.80
sync_model_paramFunction · 0.80
save_model_checkpointFunction · 0.80

Calls 1

_check_parallel_modeMethod · 0.95

Tested by

no test coverage detected