Skip to content

Commit

Permalink
Enable multi-device for more models (#30379)
Browse files Browse the repository at this point in the history
* feat: support for vitmatte

* feat: support for vivit

* feat: support for beit

* feat: support for blip :D

* feat: support for data2vec
  • Loading branch information
jla524 authored Apr 22, 2024
1 parent b20b017 commit 8b02bb6
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/transformers/models/beit/modeling_beit.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ class BeitPreTrainedModel(PreTrainedModel):
base_model_prefix = "beit"
main_input_name = "pixel_values"
supports_gradient_checkpointing = True
_no_split_modules = ["BeitLayer"]

def _init_weights(self, module):
"""Initialize the weights"""
Expand Down
1 change: 1 addition & 0 deletions src/transformers/models/blip/modeling_blip_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ class BlipTextPreTrainedModel(PreTrainedModel):

config_class = BlipTextConfig
base_model_prefix = "bert"
_no_split_modules = []

def _init_weights(self, module):
"""Initialize the weights"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ class Data2VecVisionPreTrainedModel(PreTrainedModel):
base_model_prefix = "data2vec_vision"
main_input_name = "pixel_values"
supports_gradient_checkpointing = True
_no_split_modules = ["Data2VecVisionLayer"]

def _init_weights(self, module):
"""Initialize the weights"""
Expand Down
1 change: 1 addition & 0 deletions src/transformers/models/vitmatte/modeling_vitmatte.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class VitMattePreTrainedModel(PreTrainedModel):
config_class = VitMatteConfig
main_input_name = "pixel_values"
supports_gradient_checkpointing = True
_no_split_modules = []

def _init_weights(self, module):
if isinstance(module, nn.Conv2d):
Expand Down
1 change: 1 addition & 0 deletions src/transformers/models/vivit/modeling_vivit.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ class VivitPreTrainedModel(PreTrainedModel):
base_model_prefix = "vivit"
main_input_name = "pixel_values"
supports_gradient_checkpointing = True
_no_split_modules = []

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

0 comments on commit 8b02bb6

Please sign in to comment.