Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 15 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion paddlex/pipelines/PP-ShiTuV2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion paddlex/pipelines/face_recognition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 8 additions & 1 deletion paddlex/utils/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

import os
import GPUtil
import lazy_paddle as paddle

import lazy_paddle as paddle
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需确认下是否安装了pre-commit钩子

from . import logging
from .errors import raise_unsupported_device_error

Expand All @@ -32,6 +32,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"):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这种方式看起来有点儿hack,建议加一句debug日志

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DONE。

avail_gpus = [0]
print(
Copy link
Member

@Bobholamovic Bobholamovic Dec 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用paddlex的logging模块吧,另外我们使用GPUtil是一个实现细节,不必告诉用户,只需要告知用户接下来的行为是使用gpu:0就行

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DONE.

"Detected that the current device is a Jetson edge device. Since GPUtil cannot detect GPU on Jetson, the function defaults to returning GPU: 0"
)
if not avail_gpus:
return "cpu"
else:
Expand Down