[CI][RFC] Replace black-jupyter with ruff-format (#37210)
Co-authored-by: Alison Shao <a.shao@wustl.edu>
This commit is contained in:
co-authored by
Alison Shao
parent
2641e427be
commit
28262c20df
@@ -50,7 +50,6 @@ def _serial_batched_fill(entries, vocab_mask):
|
||||
|
||||
|
||||
class TestMergeBiasTensor(CustomTestCase):
|
||||
|
||||
def test_both_none_returns_none(self):
|
||||
"""Test that merging two None tensors returns None."""
|
||||
result = merge_bias_tensor(None, None, 2, 3, DEVICE, 0.0)
|
||||
@@ -95,7 +94,6 @@ class TestMergeBiasTensor(CustomTestCase):
|
||||
|
||||
# SamplingBatchInfo.__len__
|
||||
class TestSamplingBatchInfoLen(CustomTestCase):
|
||||
|
||||
def test_len_matches_batch_size(self):
|
||||
"""Test that __len__ returns batch size (number of temperature rows)."""
|
||||
info = _make_info(batch_size=5)
|
||||
@@ -103,7 +101,6 @@ class TestSamplingBatchInfoLen(CustomTestCase):
|
||||
|
||||
|
||||
class TestMergeCustomLogitProcessor(CustomTestCase):
|
||||
|
||||
def test_both_none_returns_none(self):
|
||||
"""Test that merging two None processor dicts returns None."""
|
||||
result = SamplingBatchInfo.merge_custom_logit_processor(
|
||||
@@ -150,7 +147,6 @@ class TestMergeCustomLogitProcessor(CustomTestCase):
|
||||
|
||||
# apply_logits_bias
|
||||
class TestApplyLogitsBias(CustomTestCase):
|
||||
|
||||
def test_applies_additive_penalties(self):
|
||||
"""Test that pre-accumulated additive penalties are added to logits."""
|
||||
info = _make_info(batch_size=1)
|
||||
@@ -239,8 +235,8 @@ class TestApplyLogitsBias(CustomTestCase):
|
||||
|
||||
def make_info():
|
||||
grammar = MagicMock()
|
||||
grammar.apply_vocab_mask.side_effect = (
|
||||
lambda logits, vocab_mask: logits.add_(vocab_mask)
|
||||
grammar.apply_vocab_mask.side_effect = lambda logits, vocab_mask: (
|
||||
logits.add_(vocab_mask)
|
||||
)
|
||||
info = _make_info(batch_size=1)
|
||||
info.acc_additive_penalties = torch.linspace(
|
||||
@@ -272,7 +268,6 @@ class TestApplyLogitsBias(CustomTestCase):
|
||||
|
||||
# update_penalties
|
||||
class TestUpdatePenalties(CustomTestCase):
|
||||
|
||||
def test_required_creates_penalties_tensor(self):
|
||||
"""Test that update_penalties allocates a zero tensor and calls orchestrator methods."""
|
||||
orch = MagicMock(is_required=True)
|
||||
@@ -296,7 +291,6 @@ class TestUpdatePenalties(CustomTestCase):
|
||||
|
||||
# update_regex_vocab_mask
|
||||
class TestUpdateRegexVocabMask(CustomTestCase):
|
||||
|
||||
def test_no_grammars_clears_mask(self):
|
||||
"""Test that None grammars clears the grammar_mask."""
|
||||
info = _make_info(batch_size=1)
|
||||
@@ -379,7 +373,6 @@ class TestUpdateRegexVocabMask(CustomTestCase):
|
||||
|
||||
# filter_batch
|
||||
class TestFilterBatch(CustomTestCase):
|
||||
|
||||
def test_filter_keeps_correct_indices(self):
|
||||
"""Test that filter retains rows at indices 0 and 2, dropping index 1."""
|
||||
info = _make_info(batch_size=3)
|
||||
@@ -434,7 +427,6 @@ class TestFilterBatch(CustomTestCase):
|
||||
|
||||
# merge_batch
|
||||
class TestMergeBatch(CustomTestCase):
|
||||
|
||||
def test_merge_concatenates_tensors(self):
|
||||
"""Test that merge concatenates temperature tensors from both batches."""
|
||||
info1 = _make_info(batch_size=2)
|
||||
@@ -513,7 +505,6 @@ class TestMergeBatch(CustomTestCase):
|
||||
|
||||
# copy_for_forward
|
||||
class TestCopyForForward(CustomTestCase):
|
||||
|
||||
def test_returns_copy_without_orchestrator(self):
|
||||
"""Test that copy_for_forward returns a copy with orchestrator set to None."""
|
||||
orch = MagicMock(is_required=False)
|
||||
@@ -526,7 +517,6 @@ class TestCopyForForward(CustomTestCase):
|
||||
|
||||
# from_schedule_batch
|
||||
class TestFromScheduleBatch(CustomTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
# from_schedule_batch reads these two flags from the exec bag; give
|
||||
|
||||
Reference in New Issue
Block a user