Skip to content

Commit

Permalink
add missed imports and disabling quantization
Browse files Browse the repository at this point in the history
  • Loading branch information
eaidova committed Oct 12, 2023
1 parent 0a943d9 commit 2db9099
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion optimum/intel/openvino/modeling_seq2seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def forward(
self._compile()

# Model inputs
inputs = {self.main_input_name: input_ids}
inputs = {self.main_input_name: input_ids if input_ids is not None else kwargs.get(self.main_input_name)}

# Add the attention_mask inputs when needed
if "attention_mask" in self.input_names:
Expand Down
3 changes: 3 additions & 0 deletions optimum/intel/openvino/quantization.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,9 @@ def _set_task(self):
if self.task == "text2text-generation":
raise ValueError("Seq2Seq models are currently not supported for post-training static quantization.")

if self.task == "image-to-text":
raise ValueError("Image2Text models are currently not supported for post-training static quantization.")

def get_calibration_dataset(
self,
dataset_name: str,
Expand Down
1 change: 1 addition & 0 deletions optimum/intel/openvino/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"audio-classification": "OVModelForAudioClassification",
"stable-diffusion": "OVStableDiffusionPipeline",
"stable-diffusion-xl": "OVStableDiffusionXLPipeline",
"pix2struct": "OVModelForPix2Struct",
}


Expand Down
1 change: 1 addition & 0 deletions optimum/intel/utils/constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"seq2seq-lm": "text2text-generation",
"summarization": "text2text-generation",
"translation": "text2text-generation",
"visual-question-answering": "image-to-text",
}

_TASK_LEGACY = {
Expand Down
11 changes: 11 additions & 0 deletions optimum/intel/utils/dummy_openvino_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ def from_pretrained(cls, *args, **kwargs):
requires_backends(cls, ["openvino"])


class OVModelForPix2Struct(metaclass=DummyObject):
_backends = ["openvino"]

def __init__(self, *args, **kwargs):
requires_backends(self, ["openvino"])

@classmethod
def from_pretrained(cls, *args, **kwargs):
requires_backends(cls, ["openvino"])


class OVModelForQuestionAnswering(metaclass=DummyObject):
_backends = ["openvino"]

Expand Down

0 comments on commit 2db9099

Please sign in to comment.