Skip to content

Commit e1b80de

Browse files
authored
More fix for tiny model creation (#45228)
* add missing VivitImageProcessor * fix model_type = "evolla" * change to google/medasr * fix auto_docstring tue-mps/videomt-dinov2-small-ytvis2019 * fix 3 tester * fix test * fix modular * fix modular --------- Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
1 parent 09a3e08 commit e1b80de

10 files changed

Lines changed: 20 additions & 12 deletions

File tree

src/transformers/models/auto/image_processing_auto.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@
264264
("vit_msn", {"torchvision": "ViTImageProcessor", "pil": "ViTImageProcessorPil"}),
265265
("vitmatte", {"torchvision": "VitMatteImageProcessor", "pil": "VitMatteImageProcessorPil"}),
266266
("vitpose", {"torchvision": "VitPoseImageProcessor", "pil": "VitPoseImageProcessorPil"}),
267+
("vivit", {"torchvision": "VivitImageProcessor"}),
267268
("xclip", {"torchvision": "CLIPImageProcessor", "pil": "CLIPImageProcessorPil"}),
268269
("yolos", {"torchvision": "YolosImageProcessor", "pil": "YolosImageProcessorPil"}),
269270
("zoedepth", {"torchvision": "ZoeDepthImageProcessor", "pil": "ZoeDepthImageProcessorPil"}),

src/transformers/models/evolla/configuration_evolla.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class EvollaConfig(PreTrainedConfig):
9696
>>> configuration = model.config
9797
```"""
9898

99-
model_type = "EvollaModel"
99+
model_type = "evolla"
100100
sub_configs = {"protein_encoder_config": SaProtConfig}
101101
default_theta = 500000.0
102102

src/transformers/models/lasr/configuration_lasr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class LasrEncoderConfig(PreTrainedConfig):
6262
```
6363
6464
This configuration class is based on the LasrEncoder architecture from Google Health AI. You can find more details
65-
and pre-trained models at [TODO/TODO](https://huggingface.co/TODO/TODO).
65+
and pre-trained models at [google/medasr](https://huggingface.co/google/medasr).
6666
"""
6767

6868
model_type = "lasr_encoder"
@@ -121,7 +121,7 @@ class LasrCTCConfig(PreTrainedConfig):
121121
>>> configuration = model.config
122122
```
123123
This configuration class is based on the Lasr CTC architecture from Google Health AI. You can find more details
124-
and pre-trained models at [TODO/TODO](https://huggingface.co/TODO/TODO).
124+
and pre-trained models at [google/medasr](https://huggingface.co/google/medasr).
125125
"""
126126

127127
model_type = "lasr_ctc"

src/transformers/models/lasr/modular_lasr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class LasrEncoderConfig(ParakeetEncoderConfig):
186186
```
187187
188188
This configuration class is based on the LasrEncoder architecture from Google Health AI. You can find more details
189-
and pre-trained models at [TODO/TODO](https://huggingface.co/TODO/TODO).
189+
and pre-trained models at [google/medasr](https://huggingface.co/google/medasr).
190190
"""
191191

192192
hidden_size: int = 512
@@ -231,7 +231,7 @@ class LasrCTCConfig(ParakeetCTCConfig):
231231
>>> configuration = model.config
232232
```
233233
This configuration class is based on the Lasr CTC architecture from Google Health AI. You can find more details
234-
and pre-trained models at [TODO/TODO](https://huggingface.co/TODO/TODO).
234+
and pre-trained models at [google/medasr](https://huggingface.co/google/medasr).
235235
"""
236236

237237
vocab_size: int = 512

src/transformers/models/videomt/configuration_videomt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from ...utils import auto_docstring
2525

2626

27-
@auto_docstring(checkpoint="tue-mps/coco_panoptic_videomt_large_640")
27+
@auto_docstring(checkpoint="tue-mps/videomt-dinov2-small-ytvis2019")
2828
@strict
2929
class VideomtConfig(PreTrainedConfig):
3030
r"""

src/transformers/models/videomt/modular_videomt.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from dataclasses import dataclass
1616

1717
import torch
18+
from huggingface_hub.dataclasses import strict
1819
from torch import nn
1920

2021
from ...file_utils import ModelOutput
@@ -36,6 +37,8 @@
3637
)
3738

3839

40+
@auto_docstring(checkpoint="tue-mps/videomt-dinov2-small-ytvis2019")
41+
@strict
3942
class VideomtConfig(EomtConfig):
4043
model_type = "videomt"
4144

tests/models/pp_ocrv5_mobile_rec/test_modeling_pp_ocrv5_mobile_rec.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
class PPOCRV5MobileRecModelTester:
5252
def __init__(
5353
self,
54+
parent,
5455
batch_size=3,
5556
image_size=[48, 320],
5657
num_channels=3,
@@ -66,6 +67,7 @@ def __init__(
6667
num_stages=5,
6768
attention_dropout=0.0,
6869
):
70+
self.parent = parent
6971
self.batch_size = batch_size
7072
self.num_channels = num_channels
7173
self.image_size = image_size
@@ -142,8 +144,7 @@ class PPOCRV5MobileRecModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.
142144
model_split_percents = [0.5, 0.8]
143145

144146
def setUp(self):
145-
self.model_tester = PPOCRV5MobileRecModelTester()
146-
self.model_tester.parent = self
147+
self.model_tester = PPOCRV5MobileRecModelTester(self)
147148
self.config_tester = ConfigTester(
148149
self,
149150
config_class=PPOCRV5MobileRecConfig,

tests/models/pp_ocrv5_server_rec/test_modeling_pp_ocrv5_server_rec.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
class PPOCRV5ServerRecModelTester:
5252
def __init__(
5353
self,
54+
parent,
5455
batch_size=3,
5556
image_size=[48, 320],
5657
num_channels=3,
@@ -65,6 +66,7 @@ def __init__(
6566
num_attention_heads=2,
6667
attention_dropout=0.0,
6768
):
69+
self.parent = parent
6870
self.batch_size = batch_size
6971
self.num_channels = num_channels
7072
self.image_size = image_size
@@ -138,8 +140,7 @@ class PPOCRV5ServerRecModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.
138140
model_split_percents = [0.5, 0.8]
139141

140142
def setUp(self):
141-
self.model_tester = PPOCRV5ServerRecModelTester()
142-
self.model_tester.parent = self
143+
self.model_tester = PPOCRV5ServerRecModelTester(self)
143144
self.config_tester = ConfigTester(
144145
self,
145146
config_class=PPOCRV5ServerRecConfig,

tests/models/slanext/test_modeling_slanext.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,14 @@
5353
class SLANeXtModelTester:
5454
def __init__(
5555
self,
56+
parent,
5657
batch_size=2,
5758
image_size=512,
5859
num_channels=3,
5960
is_training=False,
6061
vision_config=None,
6162
):
63+
self.parent = parent
6264
if vision_config is None:
6365
vision_config = {
6466
"hidden_size": 1,
@@ -106,10 +108,10 @@ class SLANeXtModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase)
106108

107109
def setUp(self):
108110
self.model_tester = SLANeXtModelTester(
111+
self,
109112
batch_size=1,
110113
image_size=512,
111114
)
112-
self.model_tester.parent = self
113115
self.config_tester = ConfigTester(
114116
self,
115117
config_class=SLANeXtConfig,

tests/test_modeling_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3661,7 +3661,7 @@ def test_sdpa_can_dispatch_on_flash(self):
36613661
"PaliGemma-like models currently (transformers==4.41.0) requires an attention_mask input"
36623662
)
36633663
if config.model_type in [
3664-
"EvollaModel",
3664+
"evolla",
36653665
"modernbert",
36663666
"gemma3",
36673667
"t5gemma",

0 commit comments

Comments
 (0)