MCPcopy Create free account
hub / github.com/Alpha-VLLM/LLaMA2-Accessory / get_local_indices

Function get_local_indices

SPHINX/batch_inference.py:48–53  ·  view source on GitHub ↗
(rank: int, world_size: int, dataset_len: int)

Source from the content-addressed store, hash-verified

46
47
48def get_local_indices(rank: int, world_size: int, dataset_len: int) -> List[int]:
49 indices = list(range(dataset_len))
50 while len(indices) % world_size != 0:
51 indices.extend(indices[: world_size - len(indices) % world_size])
52 indices = indices[rank::world_size]
53 return indices
54
55
56def main() -> None:

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected