Skip to content

Commit

Permalink
Add eval method to OVModels
Browse files Browse the repository at this point in the history
  • Loading branch information
echarlaix committed Mar 7, 2024
1 parent 103620a commit ebc108b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions optimum/intel/openvino/modeling_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,9 @@ def half(self):
self.request = None
return self

def eval(self):
return self

def forward(self, *args, **kwargs):
raise NotImplementedError

Expand Down
1 change: 1 addition & 0 deletions tests/openvino/test_modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def test_load_from_hub_and_save_model(self):
tokenizer = AutoTokenizer.from_pretrained(self.OV_MODEL_ID)
tokens = tokenizer("This is a sample input", return_tensors="pt")
loaded_model = OVModelForSequenceClassification.from_pretrained(self.OV_MODEL_ID)
loaded_model.eval()
self.assertIsInstance(loaded_model.config, PretrainedConfig)
loaded_model_outputs = loaded_model(**tokens)

Expand Down

0 comments on commit ebc108b

Please sign in to comment.