[tests] further fix Tester object has no attribute '_testMethodName' (#35781)

* bug fix

* update with more cases

* more entries

* Fix

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
Fanli Lin
2025-01-29 23:05:33 +08:00
committed by GitHub
parent ec7790f0d3
commit f0ae65c198
57 changed files with 57 additions and 110 deletions

View File

@@ -29,7 +29,7 @@ if is_torchvision_available():
from transformers import ViTImageProcessorFast
class ViTImageProcessingTester(unittest.TestCase):
class ViTImageProcessingTester:
def __init__(
self,
parent,
@@ -44,7 +44,6 @@ class ViTImageProcessingTester(unittest.TestCase):
image_mean=[0.5, 0.5, 0.5],
image_std=[0.5, 0.5, 0.5],
):
super().__init__()
size = size if size is not None else {"height": 18, "width": 18}
self.parent = parent
self.batch_size = batch_size

View File

@@ -30,7 +30,7 @@ if is_flax_available():
from transformers.models.vit.modeling_flax_vit import FlaxViTForImageClassification, FlaxViTModel
class FlaxViTModelTester(unittest.TestCase):
class FlaxViTModelTester:
def __init__(
self,
parent,
@@ -72,7 +72,6 @@ class FlaxViTModelTester(unittest.TestCase):
# in ViT, the seq length equals the number of patches + 1 (we add 1 for the [CLS] token)
num_patches = (image_size // patch_size) ** 2
self.seq_length = num_patches + 1
super().__init__()
def prepare_config_and_inputs(self):
pixel_values = floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size])