Просмотр исходного кода

Develop: rectify face_recognition.yaml & PP-ShiTuV2.yaml, del device=gpu. (#2705)

* Docs: fix error in time_series_pipelines/time_series_anomaly_detection.md(.cs->.csv).

* rectify face_recognition.yaml & PP-ShiTuV2.yaml, del device=gpu.

* change the method of get_default_device, in order to fix the bug about finding no gpus on Jetson. Validated on both Jetson and Remote Server

* renew the func of get_default_device, in order to avoid the confilict with hpi.

* del DEBUG lines.

* renew

* Fix code style

* renew logging.
ZhangYutian 10 месяцев назад
Родитель
Сommit
e4e17ea6b2

+ 0 - 1
paddlex/pipelines/PP-ShiTuV2.yaml

@@ -7,7 +7,6 @@ Pipeline:
   rec_model: PP-ShiTuV2_rec
   det_batch_size: 1
   rec_batch_size: 1
-  device: gpu
   index: None
   score_thres: 0.5
   return_k: 5

+ 0 - 1
paddlex/pipelines/face_recognition.yaml

@@ -7,7 +7,6 @@ Pipeline:
   rec_model: "MobileFaceNet"
   det_batch_size: 1
   rec_batch_size: 1
-  device: gpu
   index: None
   score_thres: 0.4
   return_k: 5

+ 8 - 1
paddlex/utils/device.py

@@ -14,8 +14,8 @@
 
 import os
 import GPUtil
-import lazy_paddle as paddle
 
+import lazy_paddle as paddle
 from . import logging
 from .errors import raise_unsupported_device_error
 
@@ -33,6 +33,13 @@ def _constr_device(device_type, device_ids):
 def get_default_device():
     avail_gpus = GPUtil.getAvailable()
     if not avail_gpus:
+        # maybe edge devices like Jetson
+        if os.path.exists("/etc/nv_tegra_release"):
+            avail_gpus = [0]
+            logging.info(
+                "Detected that the current device is a Jetson edge device. The default behavior will be to use GPU: 0"
+            )
+    if not avail_gpus:
         return "cpu"
     else:
         return _constr_device("gpu", [avail_gpus[0]])