Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
0d9ddc08
P
PaddleClas
项目概览
PaddlePaddle
/
PaddleClas
1 年多 前同步成功
通知
116
Star
4999
Fork
1114
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
19
列表
看板
标记
里程碑
合并请求
6
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleClas
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
19
Issue
19
列表
看板
标记
里程碑
合并请求
6
合并请求
6
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
0d9ddc08
编写于
9月 09, 2022
作者:
Q
qili93
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TIPC] add scripts for npu and xpu, test=develop
上级
104428d3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
97 addition
and
1 deletion
+97
-1
deploy/utils/predictor.py
deploy/utils/predictor.py
+5
-1
test_tipc/test_train_inference_python_npu.sh
test_tipc/test_train_inference_python_npu.sh
+46
-0
test_tipc/test_train_inference_python_xpu.sh
test_tipc/test_train_inference_python_xpu.sh
+46
-0
未找到文件。
deploy/utils/predictor.py
浏览文件 @
0d9ddc08
...
...
@@ -60,8 +60,12 @@ class Predictor(object):
config
=
Config
(
model_file
,
params_file
)
if
args
.
use_gpu
:
if
args
.
get
(
"use_gpu"
,
False
)
:
config
.
enable_use_gpu
(
args
.
gpu_mem
,
0
)
elif
args
.
get
(
"use_npu"
,
False
):
config
.
enable_npu
()
elif
args
.
get
(
"use_xpu"
,
False
):
config
.
enable_xpu
()
else
:
config
.
disable_gpu
()
if
args
.
enable_mkldnn
:
...
...
test_tipc/test_train_inference_python_npu.sh
0 → 100644
浏览文件 @
0d9ddc08
#!/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/Global.device:gpu/Global.device:npu/g"
$FILENAME
sed
-i
"s/Global.use_gpu/Global.use_npu/g"
$FILENAME
dataline
=
`
cat
$FILENAME
`
# parser params
IFS
=
$'
\n
'
lines
=(
${
dataline
}
)
# replace inference config file
inference_py
=
$(
func_parser_value
"
${
lines
[39]
}
"
)
inference_config
=
$(
func_parser_config
${
inference_py
}
)
sed
-i
's/use_gpu: True/use_npu: True/g'
"
$REPO_ROOT_PATH
/deploy/
$inference_config
"
# replace training config file
grep
-n
'tools/.*yaml'
$FILENAME
|
cut
-d
":"
-f
1
\
|
while
read
line_num
;
do
train_cmd
=
$(
func_parser_value
"
${
lines
[line_num-1]
}
"
)
trainer_config
=
$(
func_parser_config
${
train_cmd
}
)
sed
-i
's/device: gpu/device: npu/g'
"
$REPO_ROOT_PATH
/
$trainer_config
"
done
# 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
浏览文件 @
0d9ddc08
#!/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 xpu in tipc txt configs
sed
-i
"s/Global.device:gpu/Global.device:xpu/g"
$FILENAME
sed
-i
"s/Global.use_gpu/Global.use_xpu/g"
$FILENAME
dataline
=
`
cat
$FILENAME
`
# parser params
IFS
=
$'
\n
'
lines
=(
${
dataline
}
)
# replace inference config file
inference_py
=
$(
func_parser_value
"
${
lines
[39]
}
"
)
inference_config
=
$(
func_parser_config
${
inference_py
}
)
sed
-i
's/use_gpu: True/use_xpu: True/g'
"
$REPO_ROOT_PATH
/deploy/
$inference_config
"
# replace training config file
grep
-n
'tools/.*yaml'
$FILENAME
|
cut
-d
":"
-f
1
\
|
while
read
line_num
;
do
train_cmd
=
$(
func_parser_value
"
${
lines
[line_num-1]
}
"
)
trainer_config
=
$(
func_parser_config
${
train_cmd
}
)
sed
-i
's/device: gpu/device: xpu/g'
"
$REPO_ROOT_PATH
/
$trainer_config
"
done
# pass parameters to test_train_inference_python.sh
cmd
=
"bash test_tipc/test_train_inference_python.sh
${
FILENAME
}
$2
"
echo
$cmd
eval
$cmd
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录