Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleGAN
提交
7f0b34dd
P
PaddleGAN
项目概览
PaddlePaddle
/
PaddleGAN
大约 1 年 前同步成功
通知
97
Star
7254
Fork
1210
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleGAN
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
7f0b34dd
编写于
9月 22, 2022
作者:
D
duanyanhui
提交者:
GitHub
9月 22, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TIPC] Add script for npu and xpu, test=develop (#688)
* add script for npu * add script for xpu
上级
797d5be1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
90 addition
and
2 deletion
+90
-2
ppgan/utils/setup.py
ppgan/utils/setup.py
+4
-0
test_tipc/test_train_inference_python_npu.sh
test_tipc/test_train_inference_python_npu.sh
+38
-0
test_tipc/test_train_inference_python_xpu.sh
test_tipc/test_train_inference_python_xpu.sh
+38
-0
tools/fom_infer.py
tools/fom_infer.py
+6
-0
tools/inference.py
tools/inference.py
+4
-2
未找到文件。
ppgan/utils/setup.py
浏览文件 @
7f0b34dd
...
...
@@ -43,6 +43,10 @@ def setup(args, cfg):
if
paddle
.
is_compiled_with_cuda
():
paddle
.
set_device
(
'gpu'
)
elif
paddle
.
is_compiled_with_npu
():
paddle
.
set_device
(
'npu'
)
elif
paddle
.
is_compiled_with_xpu
():
paddle
.
set_device
(
'xpu'
)
else
:
paddle
.
set_device
(
'cpu'
)
...
...
test_tipc/test_train_inference_python_npu.sh
0 → 100644
浏览文件 @
7f0b34dd
#!/bin/bash
source
test_tipc/common_func.sh
function
readlinkf
()
{
perl
-MCwd
-e
'print Cwd::abs_path shift'
"
$1
"
;
}
function
func_parser_config
()
{
strs
=
$1
IFS
=
" "
array
=(
${
strs
}
)
tmp
=
${
array
[2]
}
echo
${
tmp
}
}
BASEDIR
=
$(
dirname
"
$0
"
)
REPO_ROOT_PATH
=
$(
readlinkf
${
BASEDIR
}
/../
)
FILENAME
=
$1
# change gpu to npu in tipc txt configs
sed
-i
"s/state=GPU/state=NPU/g"
$FILENAME
sed
-i
"s/--device:gpu/--device:npu/g"
$FILENAME
sed
-i
"s/--benchmark:True/--benchmark:False/g"
$FILENAME
dataline
=
`
cat
$FILENAME
`
# change gpu to npu in execution script
sed
-i
's/\"gpu\"/\"npu\"/g'
test_tipc/test_train_inference_python.sh
sed
-i
's/--gpus/--npus/g'
test_tipc/test_train_inference_python.sh
# parser params
IFS
=
$'
\n
'
lines
=(
${
dataline
}
)
# pass parameters to test_train_inference_python.sh
cmd
=
"bash test_tipc/test_train_inference_python.sh
${
FILENAME
}
$2
"
echo
$cmd
eval
$cmd
test_tipc/test_train_inference_python_xpu.sh
0 → 100644
浏览文件 @
7f0b34dd
#!/bin/bash
source
test_tipc/common_func.sh
function
readlinkf
()
{
perl
-MCwd
-e
'print Cwd::abs_path shift'
"
$1
"
;
}
function
func_parser_config
()
{
strs
=
$1
IFS
=
" "
array
=(
${
strs
}
)
tmp
=
${
array
[2]
}
echo
${
tmp
}
}
BASEDIR
=
$(
dirname
"
$0
"
)
REPO_ROOT_PATH
=
$(
readlinkf
${
BASEDIR
}
/../
)
FILENAME
=
$1
# change gpu to npu in tipc txt configs
sed
-i
"s/state=GPU/state=XPU/g"
$FILENAME
sed
-i
"s/--device:gpu/--device:xpu/g"
$FILENAME
sed
-i
"s/--benchmark:True/--benchmark:False/g"
$FILENAME
dataline
=
`
cat
$FILENAME
`
# change gpu to npu in execution script
sed
-i
's/\"gpu\"/\"xpu\"/g'
test_tipc/test_train_inference_python.sh
sed
-i
's/--gpus/--xpus/g'
test_tipc/test_train_inference_python.sh
# parser params
IFS
=
$'
\n
'
lines
=(
${
dataline
}
)
# pass parameters to test_train_inference_python.sh
cmd
=
"bash test_tipc/test_train_inference_python.sh
${
FILENAME
}
$2
"
echo
$cmd
eval
$cmd
tools/fom_infer.py
浏览文件 @
7f0b34dd
...
...
@@ -107,6 +107,12 @@ def main():
if
args
.
device
==
"gpu"
:
kp_detector_config
.
enable_use_gpu
(
100
,
0
)
generator_config
.
enable_use_gpu
(
100
,
0
)
elif
args
.
device
==
"xpu"
:
kp_detector_config
.
enable_xpu
()
generator_config
.
enable_xpu
()
elif
args
.
device
==
"npu"
:
kp_detector_config
.
enable_npu
()
generator_config
.
enable_npu
()
else
:
kp_detector_config
.
set_mkldnn_cache_capacity
(
10
)
kp_detector_config
.
enable_mkldnn
()
...
...
tools/inference.py
浏览文件 @
7f0b34dd
...
...
@@ -41,7 +41,7 @@ def parse_args():
"--device"
,
default
=
"gpu"
,
type
=
str
,
choices
=
[
"cpu"
,
"gpu"
,
"xpu"
],
choices
=
[
"cpu"
,
"gpu"
,
"xpu"
,
"npu"
],
help
=
"The device to select to train the model, is must be cpu/gpu/xpu."
)
parser
.
add_argument
(
'-c'
,
'--config-file'
,
...
...
@@ -115,8 +115,10 @@ def create_predictor(model_path,
config
.
enable_use_gpu
(
100
,
0
)
elif
device
==
"cpu"
:
config
.
disable_gpu
()
elif
device
==
"npu"
:
config
.
enable_npu
()
elif
device
==
"xpu"
:
config
.
enable_xpu
(
100
)
config
.
enable_xpu
()
else
:
config
.
disable_gpu
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录