Skip to content

Make the Parallelizer class work for inference #715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions optimum/neuron/distributed/encoder_decoder_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def transform(
sequence_parallel_enabled: bool = False,
device: Optional[torch.device] = None,
should_parallelize_layer_predicate_func: Optional[Callable[[torch.nn.Module], bool]] = None,
**parallel_layer_specific_kwargs,
Copy link
Collaborator

@JingyaHuang JingyaHuang Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as per my experience with T5, the majority of args in parallel_layer_specific_kwargs sent to the transform() functions in T5's parallel modules raised errors, eg:

TypeError: transform() got an unexpected keyword argument 'skip_linear_weight_load'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's just a matter of adding a missing argument here.

) -> torch.nn.Module:
if should_parallelize_layer_predicate_func is not None and not should_parallelize_layer_predicate_func(layer):
return layer
Expand Down
1 change: 1 addition & 0 deletions optimum/neuron/distributed/parallel_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,7 @@ def _transform(
layer: "torch.nn.Module",
sequence_parallel_enabled: bool = False,
device: Optional["torch.device"] = None,
should_parallelize_layer_predicate_func: Optional[Callable[[torch.nn.Module], bool]] = None,
**parallel_layer_specific_kwargs,
) -> "torch.nn.Module":
skip_linear_weight_load = parallel_layer_specific_kwargs["skip_linear_weight_load"]
Expand Down
Loading