Fix remaining issues in beam score calculation (#27808)
* Fix issues in add and is_done for BeamHypotheses * make newly added arguments optional for better compatibility * Directly use cur_len as generated_len, add note for retrocompatibility * update test expectation * make cur_len represents the length of the entire sequence including the decoder prompt * remove redundant if/else in testing
This commit is contained in:
@@ -633,11 +633,7 @@ class GenerationIntegrationTestsMixin:
|
||||
"do_sample": False,
|
||||
"num_beams": 3,
|
||||
}
|
||||
if is_pt:
|
||||
expectation = 20
|
||||
else:
|
||||
# TODO (joao): fix me
|
||||
expectation = 13
|
||||
expectation = 13
|
||||
|
||||
tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-gpt2")
|
||||
text = """Hello, my dog is cute and"""
|
||||
|
||||
@@ -800,7 +800,7 @@ class ViT2GPT2ModelIntegrationTest(unittest.TestCase):
|
||||
|
||||
preds, scores = generate_step(pixel_values)
|
||||
|
||||
EXPECTED_SCORES = np.array([-0.64145195])
|
||||
EXPECTED_SCORES = np.array([-0.5956343])
|
||||
max_diff = np.amax(np.abs(scores - EXPECTED_SCORES))
|
||||
self.assertLessEqual(max_diff, 1e-4)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user