Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
6f981127
M
models
项目概览
PaddlePaddle
/
models
大约 1 年 前同步成功
通知
222
Star
6828
Fork
2962
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
602
列表
看板
标记
里程碑
合并请求
255
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
602
Issue
602
列表
看板
标记
里程碑
合并请求
255
合并请求
255
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
6f981127
编写于
7月 08, 2019
作者:
R
ruri
提交者:
GitHub
7月 08, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
check gpu (#2743)
上级
5d5a28d2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
24 addition
and
3 deletion
+24
-3
PaddleCV/image_classification/eval.py
PaddleCV/image_classification/eval.py
+2
-1
PaddleCV/image_classification/infer.py
PaddleCV/image_classification/infer.py
+2
-1
PaddleCV/image_classification/train.py
PaddleCV/image_classification/train.py
+2
-1
PaddleCV/image_classification/utils/utility.py
PaddleCV/image_classification/utils/utility.py
+18
-0
未找到文件。
PaddleCV/image_classification/eval.py
浏览文件 @
6f981127
...
...
@@ -29,7 +29,7 @@ import paddle.fluid as fluid
import
reader_cv2
as
reader
import
models
from
utils.learning_rate
import
cosine_decay
from
utils.utility
import
add_arguments
,
print_arguments
from
utils.utility
import
add_arguments
,
print_arguments
,
check_gpu
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
)
add_arg
=
functools
.
partial
(
add_arguments
,
argparser
=
parser
)
...
...
@@ -134,6 +134,7 @@ def eval(args):
def
main
():
args
=
parser
.
parse_args
()
print_arguments
(
args
)
check_gpu
(
args
.
use_gpu
)
eval
(
args
)
...
...
PaddleCV/image_classification/infer.py
浏览文件 @
6f981127
...
...
@@ -29,7 +29,7 @@ import paddle.fluid as fluid
import
reader_cv2
as
reader
import
models
import
utils
from
utils.utility
import
add_arguments
,
print_arguments
from
utils.utility
import
add_arguments
,
print_arguments
,
check_gpu
parser
=
argparse
.
ArgumentParser
(
description
=
__doc__
)
# yapf: disable
...
...
@@ -108,6 +108,7 @@ def infer(args):
def
main
():
args
=
parser
.
parse_args
()
print_arguments
(
args
)
check_gpu
(
args
.
use_gpu
)
infer
(
args
)
...
...
PaddleCV/image_classification/train.py
浏览文件 @
6f981127
...
...
@@ -47,7 +47,7 @@ import reader_cv2 as reader
import
utils
import
models
from
utils.fp16_utils
import
create_master_params_grads
,
master_param_to_train_param
from
utils.utility
import
add_arguments
,
print_arguments
from
utils.utility
import
add_arguments
,
print_arguments
,
check_gpu
from
utils.learning_rate
import
cosine_decay_with_warmup
from
dist_train
import
dist_utils
...
...
@@ -612,6 +612,7 @@ def train(args):
def
main
():
args
=
parser
.
parse_args
()
print_arguments
(
args
)
check_gpu
(
args
.
use_gpu
)
train
(
args
)
...
...
PaddleCV/image_classification/utils/utility.py
浏览文件 @
6f981127
...
...
@@ -60,3 +60,21 @@ def add_arguments(argname, type, default, help, argparser, **kwargs):
type
=
type
,
help
=
help
+
' Default: %(default)s.'
,
**
kwargs
)
def
check_gpu
(
use_gpu
):
"""
Log error and exit when set use_gpu=true in paddlepaddle
cpu version.
"""
err
=
"Config use_gpu cannot be set as true while you are "
\
"using paddlepaddle cpu version !
\n
Please try:
\n
"
\
"
\t
1. Install paddlepaddle-gpu to run model on GPU
\n
"
\
"
\t
2. Set use_gpu as false in config file to run "
\
"model on CPU"
try
:
if
use_gpu
and
not
fluid
.
is_compiled_with_cuda
():
logger
.
error
(
err
)
sys
.
exit
(
1
)
except
Exception
as
e
:
pass
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录