mirror of https://github.com/hpcaitech/ColossalAI
[NFC] polish colossalai/builder/pipeline.py code style (#638)
parent
10591ecdf9
commit
c7c224ee17
|
@ -1,7 +1,6 @@
|
|||
import copy
|
||||
import heapq
|
||||
|
||||
|
||||
from colossalai.builder import build_model, build_layer
|
||||
from colossalai.context.parallel_mode import ParallelMode
|
||||
from colossalai.core import global_context as gpc
|
||||
|
@ -40,6 +39,7 @@ def _binary_partition(weights, st, ed):
|
|||
def _heap_addition(weights, intervals, add_cnt):
|
||||
"""
|
||||
"""
|
||||
|
||||
def _heap_push(heap, st, ed):
|
||||
value = weights[ed - 1]
|
||||
if st > 0:
|
||||
|
@ -162,7 +162,10 @@ def count_layer_params(layers):
|
|||
return param_counts
|
||||
|
||||
|
||||
def build_pipeline_model_from_cfg(config, num_chunks: int = 1, partition_method: str = 'parameter', verbose: bool = False):
|
||||
def build_pipeline_model_from_cfg(config,
|
||||
num_chunks: int = 1,
|
||||
partition_method: str = 'parameter',
|
||||
verbose: bool = False):
|
||||
"""An initializer to split the model into different stages for pipeline parallelism.
|
||||
|
||||
An example for the model config is shown below. The class VisionTransformerFromConfig should
|
||||
|
|
Loading…
Reference in New Issue