-
Notifications
You must be signed in to change notification settings - Fork 361
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
[Feature] Support pipeline parallelism model wrapper #1355
base: main
Are you sure you want to change the base?
Conversation
|
||
def __init__(self, | ||
model: Union[dict, nn.Module], | ||
weights: Optional[str] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accepting weights and loading weights in model_wrapper
is inconsistent with other model wrappers. we should consider combining with BaseInferencer
to see if there's a better approach.
} | ||
# handle tied weights | ||
tied_weights = self.model_tree['tied_parameters'] | ||
for source, targets in tied_weights.items(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The key of tied_weights means param_name
, and value means list of module_name
s. So, why do we use device_map[source]
and device_map[target]
here?
Background
As the model inference process requires more and more CUDA memory, we need a way to complete the model inference process in a variety of CUDA memory situations, mainly the following two cases:
The model inference process is accomplished by cpu offload, disk offload policy.
The model can be partitioned across multiple gpus, in which case the model inference should be done as efficiently as possible.
huggingface
introduces theaccelerate
library, which can also allow users to complete the inference in the case of insufficient CUDA memory, but its utilization of resources is too inefficient.Design
To accelerate the inference process by utilizing resources as much as possible, we will implement a pipeline parallelism-based model wrapper.
The pipeline parallelism-based model wrapper is primarily responsible for:
This PR will support
MMPipelineParallel
.Environment
Validation
Experiment
ResNet-152
Scipts