Skip to content

Commit 4e0224c

Browse files
committed
fix: fixed issue #589
1 parent 7c1e460 commit 4e0224c

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

python/rapidocr/inference_engine/pytorch/device_config.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,13 @@ def config_npu(self, device_id: int) -> torch.device:
6161
try:
6262
import torch_npu
6363
except ImportError as e:
64-
logger.warning(
64+
raise ImportError(
6565
"torch_npu is not installed. \n"
6666
"Please refer to https://github.com/Ascend/pytorch to see how to install."
6767
)
68-
self.use_npu = False
69-
return self.config_cpu()
7068

71-
try:
72-
if not torch_npu.npu.is_available():
73-
raise DeviceConfigError("NPU is not available.")
74-
except DeviceConfigError as e:
75-
logger.warning(e)
76-
self.use_npu = False
77-
return self.config_cpu()
69+
if not torch_npu.npu.is_available():
70+
raise DeviceConfigError("NPU is not available.")
7871

7972
kernel_meta_dir = (model_dir / "kernel_meta").resolve()
8073
mkdir(kernel_meta_dir)

0 commit comments

Comments
 (0)