diff --git a/optimum/exporters/onnx/model_patcher.py b/optimum/exporters/onnx/model_patcher.py index 0fb55baabb0..ae3823708cc 100644 --- a/optimum/exporters/onnx/model_patcher.py +++ b/optimum/exporters/onnx/model_patcher.py @@ -16,10 +16,11 @@ import functools import inspect from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Union -from ...utils.modeling_utils import _prepare_attn_mask, _prepare_decoder_attention_mask from transformers.utils import is_torch_available +from ...utils.modeling_utils import _prepare_attn_mask, _prepare_decoder_attention_mask + if is_torch_available(): import torch