mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-04-28 11:45:23 +00:00
* Fixed several spelling errors under colossalai * Fix the spelling error in colossalai and docs directory * Cautious Changed the spelling error under the example folder * Update runtime_preparation_pass.py revert autograft to autograd * Update search_chunk.py utile to until * Update check_installation.py change misteach to mismatch in line 91 * Update 1D_tensor_parallel.md revert to perceptron * Update 2D_tensor_parallel.md revert to perceptron in line 73 * Update 2p5D_tensor_parallel.md revert to perceptron in line 71 * Update 3D_tensor_parallel.md revert to perceptron in line 80 * Update README.md revert to resnet in line 42 * Update reorder_graph.py revert to indice in line 7 * Update p2p.py revert to megatron in line 94 * Update initialize.py revert to torchrun in line 198 * Update routers.py change to detailed in line 63 * Update routers.py change to detailed in line 146 * Update README.md revert random number in line 402
30 lines
779 B
Python
30 lines
779 B
Python
from enum import Enum
|
|
|
|
|
|
class ComputePattern(Enum):
|
|
TP1D = 0
|
|
TP2D = 1
|
|
TP2P5D = 2
|
|
TP3D = 3
|
|
|
|
|
|
class ComputeSpec(object):
|
|
"""ComputeSpec
|
|
The Specification for computation pattern
|
|
|
|
Args:
|
|
compute_pattern (ComputePattern): an Enum instance for compute pattern.
|
|
"""
|
|
|
|
def __init__(self, compute_pattern: ComputePattern) -> None:
|
|
assert isinstance(compute_pattern, ComputePattern)
|
|
self.compute_pattern = compute_pattern
|
|
# Make sure output tensors are replicate
|
|
self.output_replicate = True
|
|
|
|
def __repr__(self):
|
|
return f'ComputeSpec(pattern={self.compute_pattern}, replicate_output={self.output_replicate})'
|
|
|
|
def set_output_replicate(self, flag: bool = True):
|
|
self.output_replicate = flag
|