From bc12d474a86d7e19275f3808a7d5aec16fb34325 Mon Sep 17 00:00:00 2001 From: Sai-Suraj-27 Date: Tue, 6 Jan 2026 18:12:05 +0530 Subject: [PATCH 1/3] Fixed failing BioGPT batch generation test --- tests/models/biogpt/test_modeling_biogpt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/models/biogpt/test_modeling_biogpt.py b/tests/models/biogpt/test_modeling_biogpt.py index aec7093030a8..8ee4a0dd6b24 100644 --- a/tests/models/biogpt/test_modeling_biogpt.py +++ b/tests/models/biogpt/test_modeling_biogpt.py @@ -336,7 +336,7 @@ def test_batch_generation(self): num_paddings = inputs_non_padded.shape[-1] - inputs["attention_mask"][-1].long().sum().item() inputs_padded = tokenizer(sentences[1], return_tensors="pt").input_ids.to(torch_device) output_padded = model.generate( - input_ids=inputs_padded, max_length=model.generation_config.max_length - num_paddings + input_ids=inputs_padded, max_length=20 - num_paddings ) batch_out_sentence = tokenizer.batch_decode(outputs, skip_special_tokens=True) From a25f64fe217f8d6f7794666b755b8c5851393526 Mon Sep 17 00:00:00 2001 From: Sai-Suraj-27 Date: Tue, 6 Jan 2026 18:15:52 +0530 Subject: [PATCH 2/3] Fixed failing BioGPT batch generation test --- tests/models/biogpt/test_modeling_biogpt.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/models/biogpt/test_modeling_biogpt.py b/tests/models/biogpt/test_modeling_biogpt.py index 8ee4a0dd6b24..547472e4027b 100644 --- a/tests/models/biogpt/test_modeling_biogpt.py +++ b/tests/models/biogpt/test_modeling_biogpt.py @@ -335,9 +335,7 @@ def test_batch_generation(self): num_paddings = inputs_non_padded.shape[-1] - inputs["attention_mask"][-1].long().sum().item() inputs_padded = tokenizer(sentences[1], return_tensors="pt").input_ids.to(torch_device) - output_padded = model.generate( - input_ids=inputs_padded, max_length=20 - num_paddings - ) + output_padded = model.generate(input_ids=inputs_padded, max_length=20 - num_paddings) batch_out_sentence = tokenizer.batch_decode(outputs, skip_special_tokens=True) non_padded_sentence = tokenizer.decode(output_non_padded[0], skip_special_tokens=True) From 8a01008a19a817992a8a5c3f1ae801e48225883a Mon Sep 17 00:00:00 2001 From: Sai-Suraj-27 Date: Tue, 6 Jan 2026 23:43:44 +0530 Subject: [PATCH 3/3] Comment. --- tests/models/biogpt/test_modeling_biogpt.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/models/biogpt/test_modeling_biogpt.py b/tests/models/biogpt/test_modeling_biogpt.py index 547472e4027b..da5706353c8a 100644 --- a/tests/models/biogpt/test_modeling_biogpt.py +++ b/tests/models/biogpt/test_modeling_biogpt.py @@ -335,6 +335,7 @@ def test_batch_generation(self): num_paddings = inputs_non_padded.shape[-1] - inputs["attention_mask"][-1].long().sum().item() inputs_padded = tokenizer(sentences[1], return_tensors="pt").input_ids.to(torch_device) + # 20 is the default max_length in the generation config output_padded = model.generate(input_ids=inputs_padded, max_length=20 - num_paddings) batch_out_sentence = tokenizer.batch_decode(outputs, skip_special_tokens=True)