Skip to content

Commit c617464

Browse files
faaanyecharlaix
andauthored
Apply suggestions from code review
Co-authored-by: Ella Charlaix <80481427+echarlaix@users.noreply.github.com>
1 parent be967d4 commit c617464

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

optimum/intel/ipex/modeling_base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ def _init_warmup(self):
324324
if not self._is_ipex_exported:
325325
use_cache = "past_key_values" in self.input_names
326326
dummy_inputs = prepare_jit_inputs(self, self.export_feature, use_cache)
327-
if "cpu" not in str(self._device):
327+
if self._device.type != "cpu":
328328
dummy_inputs = recursive_to_device(value=dummy_inputs, device=self._device)
329329
for _ in range(2):
330330
self(**dummy_inputs)

optimum/intel/utils/modeling_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def recursive_to_device(value, device):
178178
if isinstance(value, (tuple, list)):
179179
return type(value)(recursive_to_device(v, device) for v in value)
180180
elif isinstance(value, dict):
181-
return type(value)({k: recursive_to_device(v, device) for k, v in value.items()})
181+
return {k: recursive_to_device(v, device) for k, v in value.items()}
182182
elif isinstance(value, torch.Tensor):
183183
return value.to(device)
184184
return value

0 commit comments

Comments
 (0)