-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add parallel mapping for whether a module is row-linear parallelizabl…
…e or column-linear parallelizable
- Loading branch information
Showing
3 changed files
with
44 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,23 @@ | ||
# from transformers import AutoModel | ||
from pipegoose.nn.tensor_parallel.parallel_mapping import ParallelMapping | ||
|
||
# from pipegoose.nn.tensor_parallel.parallel_mapping import Column, ParallelMapping, Row | ||
|
||
def test_is_column_parallel_mapping(model): | ||
mappings = {} | ||
|
||
def test_parallel_mapping(): | ||
# model = AutoModel.from_pretrained("bigscience/bloom-560m") | ||
# EXPECTED_MAPPING = { | ||
# "dense_h_to_4h": Column, | ||
# "dense_4h_to_h": Row, | ||
# } | ||
for name, _ in model.named_modules(): | ||
mappings[name] = ParallelMapping.is_column_parallel(name) | ||
|
||
# mappings = {} | ||
for layer_idx in range(len(model.h)): | ||
# TODO: add check attention layer | ||
assert mappings[f"h.{layer_idx}.mlp.dense_h_to_4h"] is True | ||
|
||
# for name, module in model.named_modules(): | ||
# mappings[name] = ParallelMapping.is_column_parallel(module) | ||
|
||
# for name, parallel_type in mappings.items(): | ||
# assert isinstance(parallel_type, EXPECTED_MAPPING[name]) | ||
def test_is_row_parallel_mapping(model): | ||
mappings = {} | ||
|
||
# module = model.h[-1].mlp.dense_4h_to_h | ||
# output = ParallelMapping.is_row_parallel(module) | ||
# assert isinstance(output, Row) | ||
pass | ||
for name, _ in model.named_modules(): | ||
mappings[name] = ParallelMapping.is_row_parallel(name) | ||
|
||
for layer_idx in range(len(model.h)): | ||
# TODO: add check attention layer | ||
assert mappings[f"h.{layer_idx}.mlp.dense_4h_to_h"] is True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters