Unverified Commit 8b02bb6e authored by Jacky Lee's avatar Jacky Lee Committed by GitHub
Browse files

Enable multi-device for more models (#30379)

* feat: support for vitmatte

* feat: support for vivit

* feat: support for beit

* feat: support for blip :D

* feat: support for data2vec
parent b20b0179
...@@ -563,6 +563,7 @@ class BeitPreTrainedModel(PreTrainedModel): ...@@ -563,6 +563,7 @@ class BeitPreTrainedModel(PreTrainedModel):
base_model_prefix = "beit" base_model_prefix = "beit"
main_input_name = "pixel_values" main_input_name = "pixel_values"
supports_gradient_checkpointing = True supports_gradient_checkpointing = True
_no_split_modules = ["BeitLayer"]
def _init_weights(self, module): def _init_weights(self, module):
"""Initialize the weights""" """Initialize the weights"""
......
...@@ -549,6 +549,7 @@ class BlipTextPreTrainedModel(PreTrainedModel): ...@@ -549,6 +549,7 @@ class BlipTextPreTrainedModel(PreTrainedModel):
config_class = BlipTextConfig config_class = BlipTextConfig
base_model_prefix = "bert" base_model_prefix = "bert"
_no_split_modules = []
def _init_weights(self, module): def _init_weights(self, module):
"""Initialize the weights""" """Initialize the weights"""
......
...@@ -574,6 +574,7 @@ class Data2VecVisionPreTrainedModel(PreTrainedModel): ...@@ -574,6 +574,7 @@ class Data2VecVisionPreTrainedModel(PreTrainedModel):
base_model_prefix = "data2vec_vision" base_model_prefix = "data2vec_vision"
main_input_name = "pixel_values" main_input_name = "pixel_values"
supports_gradient_checkpointing = True supports_gradient_checkpointing = True
_no_split_modules = ["Data2VecVisionLayer"]
def _init_weights(self, module): def _init_weights(self, module):
"""Initialize the weights""" """Initialize the weights"""
......
...@@ -73,6 +73,7 @@ class VitMattePreTrainedModel(PreTrainedModel): ...@@ -73,6 +73,7 @@ class VitMattePreTrainedModel(PreTrainedModel):
config_class = VitMatteConfig config_class = VitMatteConfig
main_input_name = "pixel_values" main_input_name = "pixel_values"
supports_gradient_checkpointing = True supports_gradient_checkpointing = True
_no_split_modules = []
def _init_weights(self, module): def _init_weights(self, module):
if isinstance(module, nn.Conv2d): if isinstance(module, nn.Conv2d):
......
...@@ -387,6 +387,7 @@ class VivitPreTrainedModel(PreTrainedModel): ...@@ -387,6 +387,7 @@ class VivitPreTrainedModel(PreTrainedModel):
base_model_prefix = "vivit" base_model_prefix = "vivit"
main_input_name = "pixel_values" main_input_name = "pixel_values"
supports_gradient_checkpointing = True supports_gradient_checkpointing = True
_no_split_modules = []
def _init_weights(self, module): def _init_weights(self, module):
"""Initialize the weights""" """Initialize the weights"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment