From 1e00f2bacc66321ff1c1cfe9e5d173d3aff84191 Mon Sep 17 00:00:00 2001 From: eaidova Date: Mon, 23 Dec 2024 18:33:31 +0400 Subject: [PATCH] left padding --- tests/openvino/test_modeling.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/openvino/test_modeling.py b/tests/openvino/test_modeling.py index f9235baae..2a597276f 100644 --- a/tests/openvino/test_modeling.py +++ b/tests/openvino/test_modeling.py @@ -1296,7 +1296,15 @@ def test_beam_search(self, model_arch): transformers_model._supports_cache_class = True from transformers.cache_utils import DynamicCache tokenizer.pad_token_id = tokenizer.eos_token_id - tokens = tokenizer(["Today is a nice day and I am longer", "This is me"], return_tensors="pt", padding=True) + tokenization_args = {} + if is_transformers_version(">=", "4.45") and model_arch == "gpt_neo": + tokenization_args["padding_side"] = "left" + tokens = tokenizer( + ["Today is a nice day and I am longer", "This is me"], + return_tensors="pt", + padding=True, + **tokenization_args, + ) ov_model_stateful.generation_config.eos_token_id = None ov_model_stateless.generation_config.eos_token_id = None transformers_model.generation_config.eos_token_id = None