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:
Xin Qiu
2023-12-08 21:14:16 +08:00
committed by GitHub
parent 3ac9945e56
commit b31905d1f6
3 changed files with 31 additions and 34 deletions

View File

@@ -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"""