diff --git a/optimum/intel/openvino/modeling.py b/optimum/intel/openvino/modeling.py index 8cea5eb7b6..ceb547678b 100644 --- a/optimum/intel/openvino/modeling.py +++ b/optimum/intel/openvino/modeling.py @@ -129,7 +129,7 @@ def to(self, device: str): Use the specified `device` for inference. For example: "cpu" or "gpu". `device` can be in upper or lower case. To speed up first inference, call `.compile()` after `.to()`. """ - self._device = device.upper() + self._device = str(device).upper() self.request = None return self diff --git a/optimum/intel/openvino/modeling_diffusion.py b/optimum/intel/openvino/modeling_diffusion.py index 4443381cd6..8595e33719 100644 --- a/optimum/intel/openvino/modeling_diffusion.py +++ b/optimum/intel/openvino/modeling_diffusion.py @@ -88,7 +88,7 @@ def __init__( **kwargs, ): self._internal_dict = config - self._device = device.upper() + self._device = str(device).upper() self.is_dynamic = dynamic_shapes self.ov_config = ov_config if ov_config is not None else {} self._model_save_dir = ( diff --git a/optimum/intel/openvino/modeling_seq2seq.py b/optimum/intel/openvino/modeling_seq2seq.py index d43dbf3427..48df3b68bf 100644 --- a/optimum/intel/openvino/modeling_seq2seq.py +++ b/optimum/intel/openvino/modeling_seq2seq.py @@ -303,7 +303,7 @@ def __init__( pass def to(self, device: str): - self._device = device.upper() + self._device = str(device).upper() self.encoder._device = self._device self.decoder._device = self._device if self.use_cache: