Skip to content

Commit 3c7245a

Browse files
disable export=False in IPEXModel (#626)
* disable export=False in IPEXModel * Update optimum/intel/ipex/modeling_base.py Co-authored-by: Ella Charlaix <80481427+echarlaix@users.noreply.github.com> * fix code style --------- Co-authored-by: Ella Charlaix <80481427+echarlaix@users.noreply.github.com>
1 parent e261e21 commit 3c7245a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

optimum/intel/ipex/modeling_base.py

+5
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@ def _from_pretrained(
192192
subfolder: str = "",
193193
**kwargs,
194194
):
195+
if not getattr(config, "torchscript", False):
196+
raise ValueError(
197+
"`config.torchscript` should be set to `True`, if your model is not a TorchScript model and needs to be traced please set `export=True` when loading it with `.from_pretrained()`"
198+
)
199+
195200
# Load the model from local directory
196201
if os.path.isdir(model_id):
197202
model_cache_path = os.path.join(model_id, file_name)

0 commit comments

Comments
 (0)