fix typos in the tests directory (#36717)

This commit is contained in:
Afanti
2025-03-18 01:45:57 +08:00
committed by GitHub
parent cbfb8d7b27
commit 7f5077e536
14 changed files with 22 additions and 22 deletions

View File

@@ -436,7 +436,7 @@ NEW_BERT_CONSTANT = "value"
self.init_file(file_name, bert_test)
duplicate_module(file_name, bert_model_patterns, new_bert_model_patterns)
# There should not be a new Copied from statement, the old one should be adapated.
# There should not be a new Copied from statement, the old one should be adapted.
self.check_result(dest_file_name, bert_expected)
self.init_file(file_name, bert_test)

View File

@@ -996,7 +996,7 @@ class UtilFunctionTester(unittest.TestCase):
image = np.random.randint(0, 256, (3, 32, 64))
self.assertEqual(get_image_size(image), (32, 64))
# Test the channel dimension can be overriden
# Test the channel dimension can be overridden
image = np.random.randint(0, 256, (3, 32, 64))
self.assertEqual(get_image_size(image, channel_dim=ChannelDimension.LAST), (3, 32))

View File

@@ -411,7 +411,7 @@ class RopeTest(unittest.TestCase):
self.assertEqual(attention_scale, 1.0)
# Check 2: based on `low_freq_factor` and `high_freq_factor`, the frequencies will be scaled between 1 and
# `factor` (similar to yarn). Low frequencies get scaled by `factor`, high frequences see no change, medium
# `factor` (similar to yarn). Low frequencies get scaled by `factor`, high frequencies see no change, medium
# frequencies are scaled by a value in between. Changing `low_freq_factor` and `high_freq_factor` changes what
# is considered low, medium, and high frequencies.
factor = 10.0

View File

@@ -1686,7 +1686,7 @@ class ModelUtilsTest(TestCasePlus):
def test_isin_mps_friendly(self):
"""tests that our custom `isin_mps_friendly` matches `torch.isin`"""
random_ids = torch.randint(0, 100, (100,))
# We can match against an interger
# We can match against an integer
random_test_integer = torch.randint(0, 100, (1,)).item()
self.assertTrue(
torch.equal(
@@ -1911,7 +1911,7 @@ class ModelUtilsTest(TestCasePlus):
@require_torch_gpu
def test_loading_is_fast_on_gpu(self, model_id: str, max_loading_time: float):
"""
This test is used to avoid regresion on https://github.com/huggingface/transformers/pull/36380.
This test is used to avoid regression on https://github.com/huggingface/transformers/pull/36380.
10s should be more than enough for both models, and allows for some margin as loading time are quite
unstable. Before #36380, it used to take more than 40s, so 10s is still reasonable.
Note that we run this test in a subprocess, to ensure that cuda is not already initialized/warmed-up.