Generate: sequence bias can handle same terminations (#24822)

This commit is contained in:
Joao Gante
2023-07-20 12:23:17 +01:00
committed by GitHub
parent 37d8611ac9
commit 89136ff7f8
2 changed files with 11 additions and 28 deletions

View File

@@ -520,6 +520,9 @@ class LogitsProcessorTest(unittest.TestCase):
input_ids = torch.tensor([[0, 1, 3, 1], [0, 1, 0, 1]], device=torch_device, dtype=torch.long)
positive_bias = {(1,): 100.0, (4,): 100.0}
negative_bias = {(1, 0): -100.0, (0, 1, 2): -100.0, (1, 3, 1, 3): -100.0}
# biases the same termination twice, to ensure we can handle overlapping terminations (it won't have an effect
# on the test cases, though)
negative_bias.update({(1, 3, 1, 3, 1, 3): -100.0})
sequence_bias = {**positive_bias, **negative_bias}
# scores = 0 to facilitate checks