Skip to content
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

Enable multi-device for efficientnet #29989

Merged
merged 1 commit into from
Apr 3, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ class EfficientNetPreTrainedModel(PreTrainedModel):
config_class = EfficientNetConfig
base_model_prefix = "efficientnet"
main_input_name = "pixel_values"
_no_split_modules = []
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
_no_split_modules = []
_no_split_modules = ["EfficientNetBlock"]

any reason not to set a correct module to not split?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@ArthurZucker I don't think it's necessary for there to be a module defined - this is the case for some of our models already in the library e.g. Camembert.

It is strange not defining "EfficientNetBlock" is OK though, as the block uses a residual connection, which requires the two tensors to be on the same device (as then so too the weights).

Copy link
Collaborator

@ArthurZucker ArthurZucker Apr 2, 2024

Choose a reason for hiding this comment

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

Alright, it's not necessary, but for small GPU it helps. We'll see how it goes


def _init_weights(self, module):
"""Initialize the weights"""
Expand Down