Update ruff to 0.11.2 (#36962)
* update * update * update --------- Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
@@ -42,9 +42,9 @@ class TestFuyuImageProcessor(unittest.TestCase):
|
||||
expected_num_patches = self.processor.get_num_patches(image_height=self.height, image_width=self.width)
|
||||
|
||||
patches_final = self.processor.patchify_image(image=self.image_input)
|
||||
assert (
|
||||
patches_final.shape[1] == expected_num_patches
|
||||
), f"Expected {expected_num_patches} patches, got {patches_final.shape[1]}."
|
||||
assert patches_final.shape[1] == expected_num_patches, (
|
||||
f"Expected {expected_num_patches} patches, got {patches_final.shape[1]}."
|
||||
)
|
||||
|
||||
def test_scale_to_target_aspect_ratio(self):
|
||||
# (h:450, w:210) fitting (160, 320) -> (160, 210*160/450)
|
||||
|
||||
@@ -431,9 +431,9 @@ class GPT2ModelTester:
|
||||
model.eval()
|
||||
|
||||
# We want this for SDPA, eager works with a `None` attention mask
|
||||
assert (
|
||||
model.config._attn_implementation == "sdpa"
|
||||
), "This test assumes the model to have the SDPA implementation for its attention calculations."
|
||||
assert model.config._attn_implementation == "sdpa", (
|
||||
"This test assumes the model to have the SDPA implementation for its attention calculations."
|
||||
)
|
||||
|
||||
# Prepare cache and non_cache input, needs a full attention mask
|
||||
cached_len = input_ids.shape[-1] // 2
|
||||
|
||||
@@ -222,9 +222,9 @@ class GPTNeoXModelTester:
|
||||
model.eval()
|
||||
|
||||
# We want this for SDPA, eager works with a `None` attention mask
|
||||
assert (
|
||||
model.config._attn_implementation == "sdpa"
|
||||
), "This test assumes the model to have the SDPA implementation for its attention calculations."
|
||||
assert model.config._attn_implementation == "sdpa", (
|
||||
"This test assumes the model to have the SDPA implementation for its attention calculations."
|
||||
)
|
||||
|
||||
# Prepare cache and non_cache input, needs a full attention mask
|
||||
cached_len = input_ids.shape[-1] // 2
|
||||
|
||||
@@ -315,7 +315,7 @@ class Mask2FormerImageProcessingTest(ImageProcessingTestMixin, unittest.TestCase
|
||||
inst2class = {}
|
||||
for label in class_labels:
|
||||
instance_ids = np.unique(instance_seg[class_id_map == label])
|
||||
inst2class.update({i: label for i in instance_ids})
|
||||
inst2class.update(dict.fromkeys(instance_ids, label))
|
||||
|
||||
return instance_seg, inst2class
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@ class MaskFormerImageProcessingTest(ImageProcessingTestMixin, unittest.TestCase)
|
||||
inst2class = {}
|
||||
for label in class_labels:
|
||||
instance_ids = np.unique(instance_seg[class_id_map == label])
|
||||
inst2class.update({i: label for i in instance_ids})
|
||||
inst2class.update(dict.fromkeys(instance_ids, label))
|
||||
|
||||
return instance_seg, inst2class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user