Browse Source

tip when the model is not supported on the device

gaotingquan 7 months ago
parent
commit
f74f04cbe8
1 changed files with 16 additions and 15 deletions
  1. 16 15
      paddlex/utils/device.py

+ 16 - 15
paddlex/utils/device.py

@@ -138,26 +138,27 @@ def check_supported_device_type(device_type, model_name):
             "Skip checking if model is supported on device because the flag `PADDLE_PDX_DISABLE_DEV_MODEL_WL` has been set."
             "Skip checking if model is supported on device because the flag `PADDLE_PDX_DISABLE_DEV_MODEL_WL` has been set."
         )
         )
         return
         return
+    tips = "You could set env `PADDLE_PDX_DISABLE_DEV_MODEL_WL` to `true` to disable this checking."
     if device_type == "dcu":
     if device_type == "dcu":
-        assert (
-            model_name in DCU_WHITELIST
-        ), f"The DCU device does not yet support `{model_name}` model!"
+        assert model_name in DCU_WHITELIST, (
+            f"The DCU device does not yet support `{model_name}` model!" + tips
+        )
     elif device_type == "mlu":
     elif device_type == "mlu":
-        assert (
-            model_name in MLU_WHITELIST
-        ), f"The MLU device does not yet support `{model_name}` model!"
+        assert model_name in MLU_WHITELIST, (
+            f"The MLU device does not yet support `{model_name}` model!" + tips
+        )
     elif device_type == "npu":
     elif device_type == "npu":
-        assert (
-            model_name not in NPU_BLACKLIST
-        ), f"The NPU device does not yet support `{model_name}` model!"
+        assert model_name not in NPU_BLACKLIST, (
+            f"The NPU device does not yet support `{model_name}` model!" + tips
+        )
     elif device_type == "xpu":
     elif device_type == "xpu":
-        assert (
-            model_name in XPU_WHITELIST
-        ), f"The XPU device does not yet support `{model_name}` model!"
+        assert model_name in XPU_WHITELIST, (
+            f"The XPU device does not yet support `{model_name}` model!" + tips
+        )
     elif device_type == "gcu":
     elif device_type == "gcu":
-        assert (
-            model_name in GCU_WHITELIST
-        ), f"The GCU device does not yet support `{model_name}` model!"
+        assert model_name in GCU_WHITELIST, (
+            f"The GCU device does not yet support `{model_name}` model!" + tips
+        )
 
 
 
 
 def check_supported_device(device, model_name):
 def check_supported_device(device, model_name):