[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:
YuliangLiu0306
2022-06-21 15:23:41 +08:00
committed by GitHub
parent d1918304bb
commit 70dd88e2ee
2 changed files with 39 additions and 2 deletions

View File

@@ -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