ezpz.tp.utilsΒΆ
- See ezpz/tp/
utils.py
VocabUtility
ΒΆ
Split the vocabulary into world_size chunks and return the first and last
index of the vocabulary belonging to the rank partition.
Note that indices in [first, last]
Source code in src/ezpz/tp/utils.py
divide_and_check_no_remainder(numerator, denominator)
ΒΆ
Divide the numerator by the denominator and check that there is no remainder.
ensure_divisibility(numerator, denominator)
ΒΆ
Ensure that numerator is divisible by the denominator.
split_tensor_along_last_dim(tensor, num_partitions, contiguous_split_chunks=False)
ΒΆ
Split a tensor along its last dimension.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tensor
|
Tensor
|
The tensor to split. |
required |
num_partitions
|
int
|
The number of partitions to split the tensor into. |
required |
contiguous_split_chunks
|
bool
|
Whether to return contiguous split chunks. |
False
|