Skip to content

Commit 8e7cdd2

Browse files
Update modeling_visual_language.py
1 parent 9b76446 commit 8e7cdd2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

optimum/intel/openvino/modeling_visual_language.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,13 @@ def preprocess_inputs(
979979
Preprocess input instruction and an image.
980980
"""
981981

982+
# modified from https://github.com/huggingface/transformers/blob/v4.55.0/src/transformers/generation/utils.py#L1992
983+
def _prepare_cache_for_generation(self, *args, **kwargs):
984+
"""
985+
This function is used to prepare the cache : when calling `generate` before the first inference, an instance of `DynamicCache` will be created.
986+
For OVModel, we don't want model_kwargs to be updated before generation.
987+
"""
988+
return
982989

983990
class _OVLlavaForCausalLM(OVModelForVisualCausalLM):
984991
def __init__(

0 commit comments

Comments
 (0)