mirror of
https://github.com/YaoFANGUK/video-subtitle-remover.git
synced 2026-05-20 04:37:28 +08:00
优化 get_infer_gpuid 函数,增加对 PaddlePaddle 版本的检查
This commit is contained in:
@@ -340,7 +340,14 @@ def get_infer_gpuid():
|
|||||||
if sysstr == "Windows":
|
if sysstr == "Windows":
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if not paddle.fluid.core.is_compiled_with_rocm():
|
# 检查 PaddlePaddle 版本
|
||||||
|
paddle_version = paddle.__version__
|
||||||
|
major_version = int(paddle_version.split('.')[0])
|
||||||
|
if major_version >= 2:
|
||||||
|
is_rocm = paddle.device.is_compiled_with_rocm()
|
||||||
|
else:
|
||||||
|
is_rocm = paddle.fluid.core.is_compiled_with_rocm()
|
||||||
|
if not is_rocm:
|
||||||
cmd = "env | grep CUDA_VISIBLE_DEVICES"
|
cmd = "env | grep CUDA_VISIBLE_DEVICES"
|
||||||
else:
|
else:
|
||||||
cmd = "env | grep HIP_VISIBLE_DEVICES"
|
cmd = "env | grep HIP_VISIBLE_DEVICES"
|
||||||
|
|||||||
Reference in New Issue
Block a user