Skip to content

Commit 03803c5

Browse files
committed
left padding
1 parent 29abd71 commit 03803c5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/openvino/test_modeling.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -1295,7 +1295,15 @@ def test_beam_search(self, model_arch):
12951295
transformers_model._supports_cache_class = True
12961296
from transformers.cache_utils import DynamicCache
12971297
tokenizer.pad_token_id = tokenizer.eos_token_id
1298-
tokens = tokenizer(["Today is a nice day and I am longer", "This is me"], return_tensors="pt", padding=True)
1298+
tokenization_args = {}
1299+
if is_transformers_version(">=", "4.45") and model_arch == "gpt_neo":
1300+
tokenization_args["padding_side"] = "left"
1301+
tokens = tokenizer(
1302+
["Today is a nice day and I am longer", "This is me"],
1303+
return_tensors="pt",
1304+
padding=True,
1305+
**tokenization_args,
1306+
)
12991307
ov_model_stateful.generation_config.eos_token_id = None
13001308
ov_model_stateless.generation_config.eos_token_id = None
13011309
transformers_model.generation_config.eos_token_id = None

0 commit comments

Comments
 (0)