mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-09-24 11:08:50 +00:00
[pipeline]add customized policy (#1139)
* [CLI] add CLI launcher
* Revert "[CLI] add CLI launcher"
This reverts commit df7e6506d4
.
* [pipeline]add customized policy
This commit is contained in:
@@ -249,3 +249,24 @@ def call_module(module, args=None, kwargs=None):
|
||||
return module(*args_needed, *convert_kwargs_to_args)
|
||||
else:
|
||||
return module(*args_needed, **kwargs)
|
||||
|
||||
def customized_partition(exec_seq):
|
||||
'''
|
||||
This function will analyze the exec_seq. In the exec_seq, users will use 'SPLIT_NODE' as an
|
||||
annotation to note the partition point.
|
||||
'''
|
||||
customized_parts = {}
|
||||
start = 0
|
||||
stop = 0
|
||||
rank = 0
|
||||
for element in exec_seq:
|
||||
if isinstance(element, str):
|
||||
if element == 'SPLIT_NODE':
|
||||
customized_parts[rank] = [(start, stop)]
|
||||
start = stop
|
||||
rank += 1
|
||||
else:
|
||||
stop += 1
|
||||
customized_parts[rank] = [(start, stop)]
|
||||
return customized_parts
|
||||
|
||||
|
Reference in New Issue
Block a user