Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
a0e73bf7
M
models
项目概览
PaddlePaddle
/
models
大约 2 年 前同步成功
通知
232
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看板
提交
a0e73bf7
编写于
9月 02, 2019
作者:
L
Leo Chen
提交者:
Zeng Jinle
9月 02, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove deprecated fluid.memory_optimize, test=develop (#3136)
上级
7bae6d90
变更
27
隐藏空白更改
内联
并排
Showing
27 changed file
with
0 addition
and
139 deletion
+0
-139
AutoDL/LRC/train_mixup.py
AutoDL/LRC/train_mixup.py
+0
-1
PaddleCV/deeplabv3+/eval.py
PaddleCV/deeplabv3+/eval.py
+0
-5
PaddleCV/face_detection/profile.py
PaddleCV/face_detection/profile.py
+0
-2
PaddleCV/face_detection/train.py
PaddleCV/face_detection/train.py
+0
-5
PaddleCV/human_pose_estimation/test.py
PaddleCV/human_pose_estimation/test.py
+0
-5
PaddleCV/human_pose_estimation/train.py
PaddleCV/human_pose_estimation/train.py
+0
-5
PaddleCV/human_pose_estimation/val.py
PaddleCV/human_pose_estimation/val.py
+0
-5
PaddleCV/image_classification/eval.py
PaddleCV/image_classification/eval.py
+0
-5
PaddleCV/image_classification/fast_imagenet/train.py
PaddleCV/image_classification/fast_imagenet/train.py
+0
-4
PaddleCV/image_classification/infer.py
PaddleCV/image_classification/infer.py
+0
-5
PaddleCV/image_classification/train.py
PaddleCV/image_classification/train.py
+0
-6
PaddleCV/metric_learning/eval.py
PaddleCV/metric_learning/eval.py
+0
-5
PaddleCV/metric_learning/infer.py
PaddleCV/metric_learning/infer.py
+0
-5
PaddleCV/metric_learning/train_elem.py
PaddleCV/metric_learning/train_elem.py
+0
-4
PaddleCV/metric_learning/train_pair.py
PaddleCV/metric_learning/train_pair.py
+0
-4
PaddleCV/rcnn/train.py
PaddleCV/rcnn/train.py
+0
-1
PaddleNLP/Research/ACL2018-DAM/main.py
PaddleNLP/Research/ACL2018-DAM/main.py
+0
-13
PaddleNLP/Research/ACL2019-DuConv/generative_paddle/network.py
...eNLP/Research/ACL2019-DuConv/generative_paddle/network.py
+0
-1
PaddleNLP/Research/ACL2019-JEMT/infer.py
PaddleNLP/Research/ACL2019-JEMT/infer.py
+0
-8
PaddleNLP/Research/ACL2019-JEMT/train.py
PaddleNLP/Research/ACL2019-JEMT/train.py
+0
-8
PaddleNLP/Research/NAACL2019-MPM/run_classifier.py
PaddleNLP/Research/NAACL2019-MPM/run_classifier.py
+0
-12
PaddleNLP/unarchived/deep_attention_matching_net/test_and_evaluate.py
...archived/deep_attention_matching_net/test_and_evaluate.py
+0
-2
PaddleNLP/unarchived/deep_attention_matching_net/train_and_evaluate.py
...rchived/deep_attention_matching_net/train_and_evaluate.py
+0
-3
PaddleNLP/unarchived/neural_machine_translation/transformer/infer.py
...narchived/neural_machine_translation/transformer/infer.py
+0
-8
PaddleNLP/unarchived/neural_machine_translation/transformer/profile.py
...rchived/neural_machine_translation/transformer/profile.py
+0
-8
PaddleNLP/unarchived/neural_machine_translation/transformer/train.py
...narchived/neural_machine_translation/transformer/train.py
+0
-8
PaddleSpeech/DeepASR/train.py
PaddleSpeech/DeepASR/train.py
+0
-1
未找到文件。
AutoDL/LRC/train_mixup.py
浏览文件 @
a0e73bf7
...
@@ -176,7 +176,6 @@ def train(model, args, im_shape, steps_one_epoch):
...
@@ -176,7 +176,6 @@ def train(model, args, im_shape, steps_one_epoch):
test_py_reader
.
decorate_paddle_reader
(
test_reader
)
test_py_reader
.
decorate_paddle_reader
(
test_reader
)
fluid
.
clip
.
set_gradient_clip
(
fluid
.
clip
.
GradientClipByNorm
(
args
.
grad_clip
))
fluid
.
clip
.
set_gradient_clip
(
fluid
.
clip
.
GradientClipByNorm
(
args
.
grad_clip
))
fluid
.
memory_optimize
(
fluid
.
default_main_program
())
def
save_model
(
postfix
,
main_prog
):
def
save_model
(
postfix
,
main_prog
):
model_path
=
os
.
path
.
join
(
args
.
model_path
,
postfix
)
model_path
=
os
.
path
.
join
(
args
.
model_path
,
postfix
)
...
...
PaddleCV/deeplabv3+/eval.py
浏览文件 @
a0e73bf7
...
@@ -103,11 +103,6 @@ with fluid.program_guard(tp, sp):
...
@@ -103,11 +103,6 @@ with fluid.program_guard(tp, sp):
miou
,
out_wrong
,
out_correct
=
mean_iou
(
pred
,
label
)
miou
,
out_wrong
,
out_correct
=
mean_iou
(
pred
,
label
)
tp
=
tp
.
clone
(
True
)
tp
=
tp
.
clone
(
True
)
fluid
.
memory_optimize
(
tp
,
print_log
=
False
,
skip_opt_set
=
set
([
pred
.
name
,
miou
,
out_wrong
,
out_correct
]),
level
=
1
)
place
=
fluid
.
CPUPlace
()
place
=
fluid
.
CPUPlace
()
if
args
.
use_gpu
:
if
args
.
use_gpu
:
...
...
PaddleCV/face_detection/profile.py
浏览文件 @
a0e73bf7
...
@@ -108,8 +108,6 @@ def train(args, config, train_file_list, optimizer_method):
...
@@ -108,8 +108,6 @@ def train(args, config, train_file_list, optimizer_method):
regularization
=
fluid
.
regularizer
.
L2Decay
(
0.0005
),
regularization
=
fluid
.
regularizer
.
L2Decay
(
0.0005
),
)
)
optimizer
.
minimize
(
loss
)
optimizer
.
minimize
(
loss
)
fluid
.
memory_optimize
(
train_prog
)
place
=
fluid
.
CUDAPlace
(
0
)
if
use_gpu
else
fluid
.
CPUPlace
()
place
=
fluid
.
CUDAPlace
(
0
)
if
use_gpu
else
fluid
.
CPUPlace
()
exe
=
fluid
.
Executor
(
place
)
exe
=
fluid
.
Executor
(
place
)
...
...
PaddleCV/face_detection/train.py
浏览文件 @
a0e73bf7
...
@@ -56,7 +56,6 @@ add_arg('model_save_dir', str, 'output', "The path to save model.")
...
@@ -56,7 +56,6 @@ add_arg('model_save_dir', str, 'output', "The path to save model.")
add_arg
(
'resize_h'
,
int
,
640
,
"The resized image height."
)
add_arg
(
'resize_h'
,
int
,
640
,
"The resized image height."
)
add_arg
(
'resize_w'
,
int
,
640
,
"The resized image width."
)
add_arg
(
'resize_w'
,
int
,
640
,
"The resized image width."
)
add_arg
(
'mean_BGR'
,
str
,
'104., 117., 123.'
,
"Mean value for B,G,R channel which will be subtracted."
)
add_arg
(
'mean_BGR'
,
str
,
'104., 117., 123.'
,
"Mean value for B,G,R channel which will be subtracted."
)
add_arg
(
'with_mem_opt'
,
bool
,
True
,
"Whether to use memory optimization or not."
)
add_arg
(
'pretrained_model'
,
str
,
'./vgg_ilsvrc_16_fc_reduced/'
,
"The init model path."
)
add_arg
(
'pretrained_model'
,
str
,
'./vgg_ilsvrc_16_fc_reduced/'
,
"The init model path."
)
add_arg
(
'data_dir'
,
str
,
'data'
,
"The base dir of dataset"
)
add_arg
(
'data_dir'
,
str
,
'data'
,
"The base dir of dataset"
)
add_arg
(
'use_multiprocess'
,
bool
,
True
,
"Whether use multi-process for data preprocessing."
)
add_arg
(
'use_multiprocess'
,
bool
,
True
,
"Whether use multi-process for data preprocessing."
)
...
@@ -138,7 +137,6 @@ def train(args, config, train_params, train_file_list):
...
@@ -138,7 +137,6 @@ def train(args, config, train_params, train_file_list):
use_gpu
=
args
.
use_gpu
use_gpu
=
args
.
use_gpu
model_save_dir
=
args
.
model_save_dir
model_save_dir
=
args
.
model_save_dir
pretrained_model
=
args
.
pretrained_model
pretrained_model
=
args
.
pretrained_model
with_memory_optimization
=
args
.
with_mem_opt
devices
=
os
.
getenv
(
"CUDA_VISIBLE_DEVICES"
)
or
""
devices
=
os
.
getenv
(
"CUDA_VISIBLE_DEVICES"
)
or
""
devices_num
=
len
(
devices
.
split
(
","
))
devices_num
=
len
(
devices
.
split
(
","
))
...
@@ -166,9 +164,6 @@ def train(args, config, train_params, train_file_list):
...
@@ -166,9 +164,6 @@ def train(args, config, train_params, train_file_list):
startup_prog
=
startup_prog
,
startup_prog
=
startup_prog
,
args
=
args
)
args
=
args
)
if
with_memory_optimization
:
fluid
.
memory_optimize
(
train_prog
)
place
=
fluid
.
CUDAPlace
(
0
)
if
use_gpu
else
fluid
.
CPUPlace
()
place
=
fluid
.
CUDAPlace
(
0
)
if
use_gpu
else
fluid
.
CPUPlace
()
exe
=
fluid
.
Executor
(
place
)
exe
=
fluid
.
Executor
(
place
)
exe
.
run
(
startup_prog
)
exe
.
run
(
startup_prog
)
...
...
PaddleCV/human_pose_estimation/test.py
浏览文件 @
a0e73bf7
...
@@ -34,7 +34,6 @@ add_arg('batch_size', int, 32, "Minibatch size.")
...
@@ -34,7 +34,6 @@ add_arg('batch_size', int, 32, "Minibatch size.")
add_arg
(
'dataset'
,
str
,
'mpii'
,
"Dataset"
)
add_arg
(
'dataset'
,
str
,
'mpii'
,
"Dataset"
)
add_arg
(
'use_gpu'
,
bool
,
True
,
"Whether to use GPU or not."
)
add_arg
(
'use_gpu'
,
bool
,
True
,
"Whether to use GPU or not."
)
add_arg
(
'kp_dim'
,
int
,
16
,
"Class number."
)
add_arg
(
'kp_dim'
,
int
,
16
,
"Class number."
)
add_arg
(
'with_mem_opt'
,
bool
,
True
,
"Whether to use memory optimization or not."
)
add_arg
(
'checkpoint'
,
str
,
None
,
"Whether to resume checkpoint."
)
add_arg
(
'checkpoint'
,
str
,
None
,
"Whether to resume checkpoint."
)
add_arg
(
'flip_test'
,
bool
,
True
,
"Flip test"
)
add_arg
(
'flip_test'
,
bool
,
True
,
"Flip test"
)
add_arg
(
'shift_heatmap'
,
bool
,
True
,
"Shift heatmap"
)
add_arg
(
'shift_heatmap'
,
bool
,
True
,
"Shift heatmap"
)
...
@@ -71,10 +70,6 @@ def test(args):
...
@@ -71,10 +70,6 @@ def test(args):
# Output
# Output
output
=
model
.
net
(
input
=
image
,
target
=
None
,
target_weight
=
None
)
output
=
model
.
net
(
input
=
image
,
target
=
None
,
target_weight
=
None
)
if
args
.
with_mem_opt
:
fluid
.
memory_optimize
(
fluid
.
default_main_program
(),
skip_opt_set
=
[
output
.
name
])
place
=
fluid
.
CUDAPlace
(
0
)
if
args
.
use_gpu
else
fluid
.
CPUPlace
()
place
=
fluid
.
CUDAPlace
(
0
)
if
args
.
use_gpu
else
fluid
.
CPUPlace
()
exe
=
fluid
.
Executor
(
place
)
exe
=
fluid
.
Executor
(
place
)
exe
.
run
(
fluid
.
default_startup_program
())
exe
.
run
(
fluid
.
default_startup_program
())
...
...
PaddleCV/human_pose_estimation/train.py
浏览文件 @
a0e73bf7
...
@@ -38,7 +38,6 @@ add_arg('num_epochs', int, 140, "Number of epoc
...
@@ -38,7 +38,6 @@ add_arg('num_epochs', int, 140, "Number of epoc
add_arg
(
'total_images'
,
int
,
144406
,
"Training image number."
)
add_arg
(
'total_images'
,
int
,
144406
,
"Training image number."
)
add_arg
(
'kp_dim'
,
int
,
16
,
"Class number."
)
add_arg
(
'kp_dim'
,
int
,
16
,
"Class number."
)
add_arg
(
'model_save_dir'
,
str
,
"output"
,
"Model save directory"
)
add_arg
(
'model_save_dir'
,
str
,
"output"
,
"Model save directory"
)
add_arg
(
'with_mem_opt'
,
bool
,
True
,
"Whether to use memory optimization or not."
)
add_arg
(
'pretrained_model'
,
str
,
"pretrained/resnet_50/115"
,
"Whether to use pretrained model."
)
add_arg
(
'pretrained_model'
,
str
,
"pretrained/resnet_50/115"
,
"Whether to use pretrained model."
)
add_arg
(
'checkpoint'
,
str
,
None
,
"Whether to resume checkpoint."
)
add_arg
(
'checkpoint'
,
str
,
None
,
"Whether to resume checkpoint."
)
add_arg
(
'lr'
,
float
,
0.001
,
"Set learning rate."
)
add_arg
(
'lr'
,
float
,
0.001
,
"Set learning rate."
)
...
@@ -124,10 +123,6 @@ def train(args):
...
@@ -124,10 +123,6 @@ def train(args):
optimizer
=
optimizer_setting
(
args
,
params
)
optimizer
=
optimizer_setting
(
args
,
params
)
optimizer
.
minimize
(
loss
)
optimizer
.
minimize
(
loss
)
if
args
.
with_mem_opt
:
fluid
.
memory_optimize
(
fluid
.
default_main_program
(),
skip_opt_set
=
[
loss
.
name
,
output
.
name
,
target
.
name
])
place
=
fluid
.
CUDAPlace
(
0
)
if
args
.
use_gpu
else
fluid
.
CPUPlace
()
place
=
fluid
.
CUDAPlace
(
0
)
if
args
.
use_gpu
else
fluid
.
CPUPlace
()
exe
=
fluid
.
Executor
(
place
)
exe
=
fluid
.
Executor
(
place
)
exe
.
run
(
fluid
.
default_startup_program
())
exe
.
run
(
fluid
.
default_startup_program
())
...
...
PaddleCV/human_pose_estimation/val.py
浏览文件 @
a0e73bf7
...
@@ -38,7 +38,6 @@ add_arg('use_gpu', bool, True, "Whether to use GPU or n
...
@@ -38,7 +38,6 @@ add_arg('use_gpu', bool, True, "Whether to use GPU or n
add_arg
(
'num_epochs'
,
int
,
140
,
"Number of epochs."
)
add_arg
(
'num_epochs'
,
int
,
140
,
"Number of epochs."
)
add_arg
(
'total_images'
,
int
,
144406
,
"Training image number."
)
add_arg
(
'total_images'
,
int
,
144406
,
"Training image number."
)
add_arg
(
'kp_dim'
,
int
,
16
,
"Class number."
)
add_arg
(
'kp_dim'
,
int
,
16
,
"Class number."
)
add_arg
(
'with_mem_opt'
,
bool
,
True
,
"Whether to use memory optimization or not."
)
add_arg
(
'pretrained_model'
,
str
,
None
,
"Whether to use pretrained model."
)
add_arg
(
'pretrained_model'
,
str
,
None
,
"Whether to use pretrained model."
)
add_arg
(
'checkpoint'
,
str
,
None
,
"Whether to resume checkpoint."
)
add_arg
(
'checkpoint'
,
str
,
None
,
"Whether to resume checkpoint."
)
add_arg
(
'lr'
,
float
,
0.001
,
"Set learning rate."
)
add_arg
(
'lr'
,
float
,
0.001
,
"Set learning rate."
)
...
@@ -98,10 +97,6 @@ def valid(args):
...
@@ -98,10 +97,6 @@ def valid(args):
params
[
"learning_strategy"
][
"batch_size"
]
=
args
.
batch_size
params
[
"learning_strategy"
][
"batch_size"
]
=
args
.
batch_size
params
[
"learning_strategy"
][
"name"
]
=
args
.
lr_strategy
params
[
"learning_strategy"
][
"name"
]
=
args
.
lr_strategy
if
args
.
with_mem_opt
:
fluid
.
memory_optimize
(
fluid
.
default_main_program
(),
skip_opt_set
=
[
loss
.
name
,
output
.
name
,
target
.
name
])
place
=
fluid
.
CUDAPlace
(
0
)
if
args
.
use_gpu
else
fluid
.
CPUPlace
()
place
=
fluid
.
CUDAPlace
(
0
)
if
args
.
use_gpu
else
fluid
.
CPUPlace
()
exe
=
fluid
.
Executor
(
place
)
exe
=
fluid
.
Executor
(
place
)
exe
.
run
(
fluid
.
default_startup_program
())
exe
.
run
(
fluid
.
default_startup_program
())
...
...
PaddleCV/image_classification/eval.py
浏览文件 @
a0e73bf7
...
@@ -38,7 +38,6 @@ add_arg('batch_size', int, 256, "Minibatch size.")
...
@@ -38,7 +38,6 @@ add_arg('batch_size', int, 256, "Minibatch size.")
add_arg
(
'use_gpu'
,
bool
,
True
,
"Whether to use GPU or not."
)
add_arg
(
'use_gpu'
,
bool
,
True
,
"Whether to use GPU or not."
)
add_arg
(
'class_dim'
,
int
,
1000
,
"Class number."
)
add_arg
(
'class_dim'
,
int
,
1000
,
"Class number."
)
add_arg
(
'image_shape'
,
str
,
"3,224,224"
,
"Input image size"
)
add_arg
(
'image_shape'
,
str
,
"3,224,224"
,
"Input image size"
)
add_arg
(
'with_mem_opt'
,
bool
,
True
,
"Whether to use memory optimization or not."
)
add_arg
(
'pretrained_model'
,
str
,
None
,
"Whether to use pretrained model."
)
add_arg
(
'pretrained_model'
,
str
,
None
,
"Whether to use pretrained model."
)
add_arg
(
'model'
,
str
,
"SE_ResNeXt50_32x4d"
,
"Set the network to use."
)
add_arg
(
'model'
,
str
,
"SE_ResNeXt50_32x4d"
,
"Set the network to use."
)
add_arg
(
'resize_short_size'
,
int
,
256
,
"Set resize short size"
)
add_arg
(
'resize_short_size'
,
int
,
256
,
"Set resize short size"
)
...
@@ -50,7 +49,6 @@ def eval(args):
...
@@ -50,7 +49,6 @@ def eval(args):
class_dim
=
args
.
class_dim
class_dim
=
args
.
class_dim
model_name
=
args
.
model
model_name
=
args
.
model
pretrained_model
=
args
.
pretrained_model
pretrained_model
=
args
.
pretrained_model
with_memory_optimization
=
args
.
with_mem_opt
image_shape
=
[
int
(
m
)
for
m
in
args
.
image_shape
.
split
(
","
)]
image_shape
=
[
int
(
m
)
for
m
in
args
.
image_shape
.
split
(
","
)]
model_list
=
[
m
for
m
in
dir
(
models
)
if
"__"
not
in
m
]
model_list
=
[
m
for
m
in
dir
(
models
)
if
"__"
not
in
m
]
...
@@ -86,9 +84,6 @@ def eval(args):
...
@@ -86,9 +84,6 @@ def eval(args):
test_program
=
fluid
.
default_main_program
().
clone
(
for_test
=
True
)
test_program
=
fluid
.
default_main_program
().
clone
(
for_test
=
True
)
fetch_list
=
[
avg_cost
.
name
,
acc_top1
.
name
,
acc_top5
.
name
]
fetch_list
=
[
avg_cost
.
name
,
acc_top1
.
name
,
acc_top5
.
name
]
if
with_memory_optimization
:
fluid
.
memory_optimize
(
fluid
.
default_main_program
(),
skip_opt_set
=
set
(
fetch_list
))
place
=
fluid
.
CUDAPlace
(
0
)
if
args
.
use_gpu
else
fluid
.
CPUPlace
()
place
=
fluid
.
CUDAPlace
(
0
)
if
args
.
use_gpu
else
fluid
.
CPUPlace
()
exe
=
fluid
.
Executor
(
place
)
exe
=
fluid
.
Executor
(
place
)
...
...
PaddleCV/image_classification/fast_imagenet/train.py
浏览文件 @
a0e73bf7
...
@@ -55,7 +55,6 @@ def parse_args():
...
@@ -55,7 +55,6 @@ def parse_args():
add_arg
(
'num_threads'
,
int
,
8
,
"Use num_threads to run the fluid program."
)
add_arg
(
'num_threads'
,
int
,
8
,
"Use num_threads to run the fluid program."
)
add_arg
(
'reduce_strategy'
,
str
,
"allreduce"
,
"Choose from reduce or allreduce."
)
add_arg
(
'reduce_strategy'
,
str
,
"allreduce"
,
"Choose from reduce or allreduce."
)
add_arg
(
'log_period'
,
int
,
30
,
"Print period, defualt is 5."
)
add_arg
(
'log_period'
,
int
,
30
,
"Print period, defualt is 5."
)
add_arg
(
'memory_optimize'
,
bool
,
True
,
"Whether to enable memory optimize."
)
add_arg
(
'best_acc5'
,
float
,
0.93
,
"The best acc5, default is 93%."
)
add_arg
(
'best_acc5'
,
float
,
0.93
,
"The best acc5, default is 93%."
)
# yapf: enable
# yapf: enable
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
...
@@ -175,9 +174,6 @@ def build_program(args,
...
@@ -175,9 +174,6 @@ def build_program(args,
else
:
else
:
optimizer
.
minimize
(
avg_cost
)
optimizer
.
minimize
(
avg_cost
)
if
args
.
memory_optimize
:
fluid
.
memory_optimize
(
main_prog
,
skip_grads
=
True
)
return
avg_cost
,
optimizer
,
[
batch_acc1
,
batch_acc5
],
pyreader
return
avg_cost
,
optimizer
,
[
batch_acc1
,
batch_acc5
],
pyreader
...
...
PaddleCV/image_classification/infer.py
浏览文件 @
a0e73bf7
...
@@ -37,7 +37,6 @@ add_arg = functools.partial(add_arguments, argparser=parser)
...
@@ -37,7 +37,6 @@ add_arg = functools.partial(add_arguments, argparser=parser)
add_arg
(
'use_gpu'
,
bool
,
True
,
"Whether to use GPU or not."
)
add_arg
(
'use_gpu'
,
bool
,
True
,
"Whether to use GPU or not."
)
add_arg
(
'class_dim'
,
int
,
1000
,
"Class number."
)
add_arg
(
'class_dim'
,
int
,
1000
,
"Class number."
)
add_arg
(
'image_shape'
,
str
,
"3,224,224"
,
"Input image size"
)
add_arg
(
'image_shape'
,
str
,
"3,224,224"
,
"Input image size"
)
add_arg
(
'with_mem_opt'
,
bool
,
True
,
"Whether to use memory optimization or not."
)
add_arg
(
'pretrained_model'
,
str
,
None
,
"Whether to use pretrained model."
)
add_arg
(
'pretrained_model'
,
str
,
None
,
"Whether to use pretrained model."
)
add_arg
(
'model'
,
str
,
"SE_ResNeXt50_32x4d"
,
"Set the network to use."
)
add_arg
(
'model'
,
str
,
"SE_ResNeXt50_32x4d"
,
"Set the network to use."
)
add_arg
(
'save_inference'
,
bool
,
False
,
"Whether to save inference model or not"
)
add_arg
(
'save_inference'
,
bool
,
False
,
"Whether to save inference model or not"
)
...
@@ -51,7 +50,6 @@ def infer(args):
...
@@ -51,7 +50,6 @@ def infer(args):
model_name
=
args
.
model
model_name
=
args
.
model
save_inference
=
args
.
save_inference
save_inference
=
args
.
save_inference
pretrained_model
=
args
.
pretrained_model
pretrained_model
=
args
.
pretrained_model
with_memory_optimization
=
args
.
with_mem_opt
image_shape
=
[
int
(
m
)
for
m
in
args
.
image_shape
.
split
(
","
)]
image_shape
=
[
int
(
m
)
for
m
in
args
.
image_shape
.
split
(
","
)]
model_list
=
[
m
for
m
in
dir
(
models
)
if
"__"
not
in
m
]
model_list
=
[
m
for
m
in
dir
(
models
)
if
"__"
not
in
m
]
assert
model_name
in
model_list
,
"{} is not in lists: {}"
.
format
(
args
.
model
,
assert
model_name
in
model_list
,
"{} is not in lists: {}"
.
format
(
args
.
model
,
...
@@ -70,9 +68,6 @@ def infer(args):
...
@@ -70,9 +68,6 @@ def infer(args):
test_program
=
fluid
.
default_main_program
().
clone
(
for_test
=
True
)
test_program
=
fluid
.
default_main_program
().
clone
(
for_test
=
True
)
fetch_list
=
[
out
.
name
]
fetch_list
=
[
out
.
name
]
if
with_memory_optimization
and
not
save_inference
:
fluid
.
memory_optimize
(
fluid
.
default_main_program
(),
skip_opt_set
=
set
(
fetch_list
))
place
=
fluid
.
CUDAPlace
(
0
)
if
args
.
use_gpu
else
fluid
.
CPUPlace
()
place
=
fluid
.
CUDAPlace
(
0
)
if
args
.
use_gpu
else
fluid
.
CPUPlace
()
exe
=
fluid
.
Executor
(
place
)
exe
=
fluid
.
Executor
(
place
)
...
...
PaddleCV/image_classification/train.py
浏览文件 @
a0e73bf7
...
@@ -65,7 +65,6 @@ add_arg('num_epochs', int, 120, "number of epochs.")
...
@@ -65,7 +65,6 @@ add_arg('num_epochs', int, 120, "number of epochs.")
add_arg
(
'class_dim'
,
int
,
1000
,
"Class number."
)
add_arg
(
'class_dim'
,
int
,
1000
,
"Class number."
)
add_arg
(
'image_shape'
,
str
,
"3,224,224"
,
"input image size"
)
add_arg
(
'image_shape'
,
str
,
"3,224,224"
,
"input image size"
)
add_arg
(
'model_save_dir'
,
str
,
"output"
,
"model save directory"
)
add_arg
(
'model_save_dir'
,
str
,
"output"
,
"model save directory"
)
add_arg
(
'with_mem_opt'
,
bool
,
False
,
"Whether to use memory optimization or not."
)
add_arg
(
'with_inplace'
,
bool
,
True
,
"Whether to use inplace memory optimization."
)
add_arg
(
'with_inplace'
,
bool
,
True
,
"Whether to use inplace memory optimization."
)
add_arg
(
'pretrained_model'
,
str
,
None
,
"Whether to use pretrained model."
)
add_arg
(
'pretrained_model'
,
str
,
None
,
"Whether to use pretrained model."
)
add_arg
(
'checkpoint'
,
str
,
None
,
"Whether to resume checkpoint."
)
add_arg
(
'checkpoint'
,
str
,
None
,
"Whether to resume checkpoint."
)
...
@@ -347,7 +346,6 @@ def train(args):
...
@@ -347,7 +346,6 @@ def train(args):
model_name
=
args
.
model
model_name
=
args
.
model
checkpoint
=
args
.
checkpoint
checkpoint
=
args
.
checkpoint
pretrained_model
=
args
.
pretrained_model
pretrained_model
=
args
.
pretrained_model
with_memory_optimization
=
args
.
with_mem_opt
model_save_dir
=
args
.
model_save_dir
model_save_dir
=
args
.
model_save_dir
use_mixup
=
args
.
use_mixup
use_mixup
=
args
.
use_mixup
...
@@ -387,10 +385,6 @@ def train(args):
...
@@ -387,10 +385,6 @@ def train(args):
test_py_reader
,
test_cost
,
test_acc1
,
test_acc5
=
b_out_test
[
0
],
b_out_test
[
1
],
b_out_test
[
2
],
b_out_test
[
3
]
test_py_reader
,
test_cost
,
test_acc1
,
test_acc5
=
b_out_test
[
0
],
b_out_test
[
1
],
b_out_test
[
2
],
b_out_test
[
3
]
test_prog
=
test_prog
.
clone
(
for_test
=
True
)
test_prog
=
test_prog
.
clone
(
for_test
=
True
)
if
with_memory_optimization
:
fluid
.
memory_optimize
(
train_prog
)
fluid
.
memory_optimize
(
test_prog
)
gpu_id
=
int
(
os
.
environ
.
get
(
'FLAGS_selected_gpus'
,
0
))
gpu_id
=
int
(
os
.
environ
.
get
(
'FLAGS_selected_gpus'
,
0
))
place
=
fluid
.
CUDAPlace
(
gpu_id
)
if
args
.
use_gpu
else
fluid
.
CPUPlace
()
place
=
fluid
.
CUDAPlace
(
gpu_id
)
if
args
.
use_gpu
else
fluid
.
CPUPlace
()
exe
=
fluid
.
Executor
(
place
)
exe
=
fluid
.
Executor
(
place
)
...
...
PaddleCV/metric_learning/eval.py
浏览文件 @
a0e73bf7
...
@@ -37,7 +37,6 @@ add_arg('embedding_size', int, 0, "Embedding size.")
...
@@ -37,7 +37,6 @@ add_arg('embedding_size', int, 0, "Embedding size.")
add_arg
(
'batch_size'
,
int
,
10
,
"Minibatch size."
)
add_arg
(
'batch_size'
,
int
,
10
,
"Minibatch size."
)
add_arg
(
'image_shape'
,
str
,
"3,224,224"
,
"Input image size."
)
add_arg
(
'image_shape'
,
str
,
"3,224,224"
,
"Input image size."
)
add_arg
(
'use_gpu'
,
bool
,
True
,
"Whether to use GPU or not."
)
add_arg
(
'use_gpu'
,
bool
,
True
,
"Whether to use GPU or not."
)
add_arg
(
'with_mem_opt'
,
bool
,
False
,
"Whether to use memory optimization or not."
)
add_arg
(
'pretrained_model'
,
str
,
None
,
"Whether to use pretrained model."
)
add_arg
(
'pretrained_model'
,
str
,
None
,
"Whether to use pretrained model."
)
# yapf: enable
# yapf: enable
...
@@ -48,7 +47,6 @@ def eval(args):
...
@@ -48,7 +47,6 @@ def eval(args):
# parameters from arguments
# parameters from arguments
model_name
=
args
.
model
model_name
=
args
.
model
pretrained_model
=
args
.
pretrained_model
pretrained_model
=
args
.
pretrained_model
with_memory_optimization
=
args
.
with_mem_opt
image_shape
=
[
int
(
m
)
for
m
in
args
.
image_shape
.
split
(
","
)]
image_shape
=
[
int
(
m
)
for
m
in
args
.
image_shape
.
split
(
","
)]
assert
model_name
in
model_list
,
"{} is not in lists: {}"
.
format
(
args
.
model
,
assert
model_name
in
model_list
,
"{} is not in lists: {}"
.
format
(
args
.
model
,
...
@@ -63,9 +61,6 @@ def eval(args):
...
@@ -63,9 +61,6 @@ def eval(args):
test_program
=
fluid
.
default_main_program
().
clone
(
for_test
=
True
)
test_program
=
fluid
.
default_main_program
().
clone
(
for_test
=
True
)
if
with_memory_optimization
:
fluid
.
memory_optimize
(
fluid
.
default_main_program
())
place
=
fluid
.
CUDAPlace
(
0
)
if
args
.
use_gpu
else
fluid
.
CPUPlace
()
place
=
fluid
.
CUDAPlace
(
0
)
if
args
.
use_gpu
else
fluid
.
CPUPlace
()
exe
=
fluid
.
Executor
(
place
)
exe
=
fluid
.
Executor
(
place
)
exe
.
run
(
fluid
.
default_startup_program
())
exe
.
run
(
fluid
.
default_startup_program
())
...
...
PaddleCV/metric_learning/infer.py
浏览文件 @
a0e73bf7
...
@@ -36,7 +36,6 @@ add_arg('embedding_size', int, 0, "Embedding size.")
...
@@ -36,7 +36,6 @@ add_arg('embedding_size', int, 0, "Embedding size.")
add_arg
(
'batch_size'
,
int
,
1
,
"Minibatch size."
)
add_arg
(
'batch_size'
,
int
,
1
,
"Minibatch size."
)
add_arg
(
'image_shape'
,
str
,
"3,224,224"
,
"Input image size."
)
add_arg
(
'image_shape'
,
str
,
"3,224,224"
,
"Input image size."
)
add_arg
(
'use_gpu'
,
bool
,
True
,
"Whether to use GPU or not."
)
add_arg
(
'use_gpu'
,
bool
,
True
,
"Whether to use GPU or not."
)
add_arg
(
'with_mem_opt'
,
bool
,
False
,
"Whether to use memory optimization or not."
)
add_arg
(
'pretrained_model'
,
str
,
None
,
"Whether to use pretrained model."
)
add_arg
(
'pretrained_model'
,
str
,
None
,
"Whether to use pretrained model."
)
# yapf: enable
# yapf: enable
...
@@ -47,7 +46,6 @@ def infer(args):
...
@@ -47,7 +46,6 @@ def infer(args):
# parameters from arguments
# parameters from arguments
model_name
=
args
.
model
model_name
=
args
.
model
pretrained_model
=
args
.
pretrained_model
pretrained_model
=
args
.
pretrained_model
with_memory_optimization
=
args
.
with_mem_opt
image_shape
=
[
int
(
m
)
for
m
in
args
.
image_shape
.
split
(
","
)]
image_shape
=
[
int
(
m
)
for
m
in
args
.
image_shape
.
split
(
","
)]
assert
model_name
in
model_list
,
"{} is not in lists: {}"
.
format
(
args
.
model
,
assert
model_name
in
model_list
,
"{} is not in lists: {}"
.
format
(
args
.
model
,
...
@@ -61,9 +59,6 @@ def infer(args):
...
@@ -61,9 +59,6 @@ def infer(args):
test_program
=
fluid
.
default_main_program
().
clone
(
for_test
=
True
)
test_program
=
fluid
.
default_main_program
().
clone
(
for_test
=
True
)
if
with_memory_optimization
:
fluid
.
memory_optimize
(
fluid
.
default_main_program
())
place
=
fluid
.
CUDAPlace
(
0
)
if
args
.
use_gpu
else
fluid
.
CPUPlace
()
place
=
fluid
.
CUDAPlace
(
0
)
if
args
.
use_gpu
else
fluid
.
CPUPlace
()
exe
=
fluid
.
Executor
(
place
)
exe
=
fluid
.
Executor
(
place
)
exe
.
run
(
fluid
.
default_startup_program
())
exe
.
run
(
fluid
.
default_startup_program
())
...
...
PaddleCV/metric_learning/train_elem.py
浏览文件 @
a0e73bf7
...
@@ -51,7 +51,6 @@ add_arg('display_iter_step', int, 10, "display_iter_step.")
...
@@ -51,7 +51,6 @@ add_arg('display_iter_step', int, 10, "display_iter_step.")
add_arg
(
'test_iter_step'
,
int
,
1000
,
"test_iter_step."
)
add_arg
(
'test_iter_step'
,
int
,
1000
,
"test_iter_step."
)
add_arg
(
'save_iter_step'
,
int
,
1000
,
"save_iter_step."
)
add_arg
(
'save_iter_step'
,
int
,
1000
,
"save_iter_step."
)
add_arg
(
'use_gpu'
,
bool
,
True
,
"Whether to use GPU or not."
)
add_arg
(
'use_gpu'
,
bool
,
True
,
"Whether to use GPU or not."
)
add_arg
(
'with_mem_opt'
,
bool
,
True
,
"Whether to use memory optimization or not."
)
add_arg
(
'pretrained_model'
,
str
,
None
,
"Whether to use pretrained model."
)
add_arg
(
'pretrained_model'
,
str
,
None
,
"Whether to use pretrained model."
)
add_arg
(
'checkpoint'
,
str
,
None
,
"Whether to resume checkpoint."
)
add_arg
(
'checkpoint'
,
str
,
None
,
"Whether to resume checkpoint."
)
add_arg
(
'model_save_dir'
,
str
,
"output"
,
"model save directory"
)
add_arg
(
'model_save_dir'
,
str
,
"output"
,
"model save directory"
)
...
@@ -179,9 +178,6 @@ def train_async(args):
...
@@ -179,9 +178,6 @@ def train_async(args):
train_fetch_list
=
[
global_lr
.
name
,
train_cost
.
name
,
train_acc1
.
name
,
train_acc5
.
name
]
train_fetch_list
=
[
global_lr
.
name
,
train_cost
.
name
,
train_acc1
.
name
,
train_acc5
.
name
]
test_fetch_list
=
[
test_feas
.
name
]
test_fetch_list
=
[
test_feas
.
name
]
if
args
.
with_mem_opt
:
fluid
.
memory_optimize
(
train_prog
,
skip_opt_set
=
set
(
train_fetch_list
))
place
=
fluid
.
CUDAPlace
(
0
)
if
args
.
use_gpu
else
fluid
.
CPUPlace
()
place
=
fluid
.
CUDAPlace
(
0
)
if
args
.
use_gpu
else
fluid
.
CPUPlace
()
exe
=
fluid
.
Executor
(
place
)
exe
=
fluid
.
Executor
(
place
)
...
...
PaddleCV/metric_learning/train_pair.py
浏览文件 @
a0e73bf7
...
@@ -53,7 +53,6 @@ add_arg('display_iter_step', int, 10, "display_iter_step.")
...
@@ -53,7 +53,6 @@ add_arg('display_iter_step', int, 10, "display_iter_step.")
add_arg
(
'test_iter_step'
,
int
,
5000
,
"test_iter_step."
)
add_arg
(
'test_iter_step'
,
int
,
5000
,
"test_iter_step."
)
add_arg
(
'save_iter_step'
,
int
,
5000
,
"save_iter_step."
)
add_arg
(
'save_iter_step'
,
int
,
5000
,
"save_iter_step."
)
add_arg
(
'use_gpu'
,
bool
,
True
,
"Whether to use GPU or not."
)
add_arg
(
'use_gpu'
,
bool
,
True
,
"Whether to use GPU or not."
)
add_arg
(
'with_mem_opt'
,
bool
,
True
,
"Whether to use memory optimization or not."
)
add_arg
(
'pretrained_model'
,
str
,
None
,
"Whether to use pretrained model."
)
add_arg
(
'pretrained_model'
,
str
,
None
,
"Whether to use pretrained model."
)
add_arg
(
'checkpoint'
,
str
,
None
,
"Whether to resume checkpoint."
)
add_arg
(
'checkpoint'
,
str
,
None
,
"Whether to resume checkpoint."
)
add_arg
(
'model_save_dir'
,
str
,
"output"
,
"model save directory"
)
add_arg
(
'model_save_dir'
,
str
,
"output"
,
"model save directory"
)
...
@@ -180,9 +179,6 @@ def train_async(args):
...
@@ -180,9 +179,6 @@ def train_async(args):
train_fetch_list
=
[
global_lr
.
name
,
train_cost
.
name
,
train_feas
.
name
,
train_label
.
name
]
train_fetch_list
=
[
global_lr
.
name
,
train_cost
.
name
,
train_feas
.
name
,
train_label
.
name
]
test_fetch_list
=
[
test_feas
.
name
]
test_fetch_list
=
[
test_feas
.
name
]
if
args
.
with_mem_opt
:
fluid
.
memory_optimize
(
train_prog
,
skip_opt_set
=
set
(
train_fetch_list
))
place
=
fluid
.
CUDAPlace
(
0
)
if
args
.
use_gpu
else
fluid
.
CPUPlace
()
place
=
fluid
.
CUDAPlace
(
0
)
if
args
.
use_gpu
else
fluid
.
CPUPlace
()
exe
=
fluid
.
Executor
(
place
)
exe
=
fluid
.
Executor
(
place
)
...
...
PaddleCV/rcnn/train.py
浏览文件 @
a0e73bf7
...
@@ -105,7 +105,6 @@ def train():
...
@@ -105,7 +105,6 @@ def train():
for
var
in
fetch_list
:
for
var
in
fetch_list
:
var
.
persistable
=
True
var
.
persistable
=
True
#fluid.memory_optimize(fluid.default_main_program(), skip_opt_set=set(fetch_list))
gpu_id
=
int
(
os
.
environ
.
get
(
'FLAGS_selected_gpus'
,
0
))
gpu_id
=
int
(
os
.
environ
.
get
(
'FLAGS_selected_gpus'
,
0
))
place
=
fluid
.
CUDAPlace
(
gpu_id
)
if
cfg
.
use_gpu
else
fluid
.
CPUPlace
()
place
=
fluid
.
CUDAPlace
(
gpu_id
)
if
cfg
.
use_gpu
else
fluid
.
CPUPlace
()
exe
=
fluid
.
Executor
(
place
)
exe
=
fluid
.
Executor
(
place
)
...
...
PaddleNLP/Research/ACL2018-DAM/main.py
浏览文件 @
a0e73bf7
...
@@ -145,13 +145,6 @@ def train(args):
...
@@ -145,13 +145,6 @@ def train(args):
decay_rate
=
0.9
,
decay_rate
=
0.9
,
staircase
=
True
))
staircase
=
True
))
optimizer
.
minimize
(
loss
)
optimizer
.
minimize
(
loss
)
print
(
"begin memory optimization ..."
)
print
(
time
.
strftime
(
'%Y-%m-%d %H:%M:%S'
,
time
.
localtime
(
time
.
time
())))
fluid
.
memory_optimize
(
train_program
)
print
(
"end memory optimization ..."
)
print
(
time
.
strftime
(
'%Y-%m-%d %H:%M:%S'
,
time
.
localtime
(
time
.
time
())))
test_program
=
fluid
.
Program
()
test_program
=
fluid
.
Program
()
test_startup
=
fluid
.
Program
()
test_startup
=
fluid
.
Program
()
...
@@ -383,12 +376,6 @@ def test(args):
...
@@ -383,12 +376,6 @@ def test(args):
staircase
=
True
))
staircase
=
True
))
optimizer
.
minimize
(
loss
)
optimizer
.
minimize
(
loss
)
print
(
"begin memory optimization ..."
)
print
(
time
.
strftime
(
'%Y-%m-%d %H:%M:%S'
,
time
.
localtime
(
time
.
time
())))
fluid
.
memory_optimize
(
fluid
.
default_main_program
())
print
(
"end memory optimization ..."
)
print
(
time
.
strftime
(
'%Y-%m-%d %H:%M:%S'
,
time
.
localtime
(
time
.
time
())))
if
args
.
use_cuda
:
if
args
.
use_cuda
:
place
=
fluid
.
CUDAPlace
(
0
)
place
=
fluid
.
CUDAPlace
(
0
)
dev_count
=
fluid
.
core
.
get_cuda_device_count
()
dev_count
=
fluid
.
core
.
get_cuda_device_count
()
...
...
PaddleNLP/Research/ACL2019-DuConv/generative_paddle/network.py
浏览文件 @
a0e73bf7
...
@@ -482,7 +482,6 @@ def train(config):
...
@@ -482,7 +482,6 @@ def train(config):
print
(
"stage 1"
)
print
(
"stage 1"
)
optimizer
.
minimize
(
final_loss
)
optimizer
.
minimize
(
final_loss
)
fluid
.
memory_optimize
(
main_program
)
opt_var_name_list
=
optimizer
.
get_opti_var_name_list
()
opt_var_name_list
=
optimizer
.
get_opti_var_name_list
()
if
config
.
use_gpu
:
if
config
.
use_gpu
:
...
...
PaddleNLP/Research/ACL2019-JEMT/infer.py
浏览文件 @
a0e73bf7
...
@@ -65,11 +65,6 @@ def parse_args():
...
@@ -65,11 +65,6 @@ def parse_args():
default
=
" "
,
default
=
" "
,
help
=
"The delimiter used to split tokens in source or target sentences. "
help
=
"The delimiter used to split tokens in source or target sentences. "
"For EN-DE BPE data we provided, use spaces as token delimiter. "
)
"For EN-DE BPE data we provided, use spaces as token delimiter. "
)
parser
.
add_argument
(
"--use_mem_opt"
,
type
=
ast
.
literal_eval
,
default
=
True
,
help
=
"The flag indicating whether to use memory optimization."
)
parser
.
add_argument
(
parser
.
add_argument
(
"--use_py_reader"
,
"--use_py_reader"
,
type
=
ast
.
literal_eval
,
type
=
ast
.
literal_eval
,
...
@@ -231,9 +226,6 @@ def fast_infer(args):
...
@@ -231,9 +226,6 @@ def fast_infer(args):
# This is used here to set dropout to the test mode.
# This is used here to set dropout to the test mode.
infer_program
=
fluid
.
default_main_program
().
clone
(
for_test
=
True
)
infer_program
=
fluid
.
default_main_program
().
clone
(
for_test
=
True
)
if
args
.
use_mem_opt
:
fluid
.
memory_optimize
(
infer_program
)
if
InferTaskConfig
.
use_gpu
:
if
InferTaskConfig
.
use_gpu
:
place
=
fluid
.
CUDAPlace
(
0
)
place
=
fluid
.
CUDAPlace
(
0
)
dev_count
=
fluid
.
core
.
get_cuda_device_count
()
dev_count
=
fluid
.
core
.
get_cuda_device_count
()
...
...
PaddleNLP/Research/ACL2019-JEMT/train.py
浏览文件 @
a0e73bf7
...
@@ -124,11 +124,6 @@ def parse_args():
...
@@ -124,11 +124,6 @@ def parse_args():
default
=
False
,
default
=
False
,
help
=
"The flag indicating whether to run the task "
help
=
"The flag indicating whether to run the task "
"for continuous evaluation."
)
"for continuous evaluation."
)
parser
.
add_argument
(
"--use_mem_opt"
,
type
=
ast
.
literal_eval
,
default
=
True
,
help
=
"The flag indicating whether to use memory optimization."
)
parser
.
add_argument
(
parser
.
add_argument
(
"--use_py_reader"
,
"--use_py_reader"
,
type
=
ast
.
literal_eval
,
type
=
ast
.
literal_eval
,
...
@@ -737,9 +732,6 @@ def train(args):
...
@@ -737,9 +732,6 @@ def train(args):
optimizer
=
fluid
.
optimizer
.
SGD
(
0.003
)
optimizer
=
fluid
.
optimizer
.
SGD
(
0.003
)
optimizer
.
minimize
(
avg_cost
)
optimizer
.
minimize
(
avg_cost
)
if
args
.
use_mem_opt
:
fluid
.
memory_optimize
(
train_prog
)
if
args
.
local
:
if
args
.
local
:
logging
.
info
(
"local start_up:"
)
logging
.
info
(
"local start_up:"
)
train_loop
(
exe
,
train_prog
,
startup_prog
,
dev_count
,
sum_cost
,
train_loop
(
exe
,
train_prog
,
startup_prog
,
dev_count
,
sum_cost
,
...
...
PaddleNLP/Research/NAACL2019-MPM/run_classifier.py
浏览文件 @
a0e73bf7
...
@@ -271,12 +271,6 @@ def kfold_program(args, processor, train_examples, dev_examples, test_examples,
...
@@ -271,12 +271,6 @@ def kfold_program(args, processor, train_examples, dev_examples, test_examples,
use_fp16
=
args
.
use_fp16
,
use_fp16
=
args
.
use_fp16
,
loss_scaling
=
args
.
loss_scaling
)
loss_scaling
=
args
.
loss_scaling
)
fluid
.
memory_optimize
(
input_program
=
train_program
,
skip_opt_set
=
[
loss
.
name
,
probs
.
name
,
accuracy
.
name
,
num_seqs
.
name
])
if
args
.
verbose
:
if
args
.
verbose
:
if
args
.
in_tokens
:
if
args
.
in_tokens
:
lower_mem
,
upper_mem
,
unit
=
fluid
.
contrib
.
memory_usage
(
lower_mem
,
upper_mem
,
unit
=
fluid
.
contrib
.
memory_usage
(
...
@@ -549,12 +543,6 @@ def train_single(args):
...
@@ -549,12 +543,6 @@ def train_single(args):
use_fp16
=
args
.
use_fp16
,
use_fp16
=
args
.
use_fp16
,
loss_scaling
=
args
.
loss_scaling
)
loss_scaling
=
args
.
loss_scaling
)
fluid
.
memory_optimize
(
input_program
=
train_program
,
skip_opt_set
=
[
loss
.
name
,
probs
.
name
,
accuracy
.
name
,
num_seqs
.
name
])
if
args
.
verbose
:
if
args
.
verbose
:
if
args
.
in_tokens
:
if
args
.
in_tokens
:
lower_mem
,
upper_mem
,
unit
=
fluid
.
contrib
.
memory_usage
(
lower_mem
,
upper_mem
,
unit
=
fluid
.
contrib
.
memory_usage
(
...
...
PaddleNLP/unarchived/deep_attention_matching_net/test_and_evaluate.py
浏览文件 @
a0e73bf7
...
@@ -145,8 +145,6 @@ def test(args):
...
@@ -145,8 +145,6 @@ def test(args):
staircase
=
True
))
staircase
=
True
))
optimizer
.
minimize
(
loss
)
optimizer
.
minimize
(
loss
)
fluid
.
memory_optimize
(
fluid
.
default_main_program
())
if
args
.
use_cuda
:
if
args
.
use_cuda
:
place
=
fluid
.
CUDAPlace
(
0
)
place
=
fluid
.
CUDAPlace
(
0
)
dev_count
=
fluid
.
core
.
get_cuda_device_count
()
dev_count
=
fluid
.
core
.
get_cuda_device_count
()
...
...
PaddleNLP/unarchived/deep_attention_matching_net/train_and_evaluate.py
浏览文件 @
a0e73bf7
...
@@ -216,9 +216,6 @@ def train(args):
...
@@ -216,9 +216,6 @@ def train(args):
decay_rate
=
0.9
,
decay_rate
=
0.9
,
staircase
=
True
))
staircase
=
True
))
optimizer
.
minimize
(
loss
)
optimizer
.
minimize
(
loss
)
print
(
"begin memory optimization ..."
)
fluid
.
memory_optimize
(
train_program
)
print
(
"end memory optimization ..."
)
test_program
=
fluid
.
Program
()
test_program
=
fluid
.
Program
()
test_startup
=
fluid
.
Program
()
test_startup
=
fluid
.
Program
()
...
...
PaddleNLP/unarchived/neural_machine_translation/transformer/infer.py
浏览文件 @
a0e73bf7
...
@@ -56,11 +56,6 @@ def parse_args():
...
@@ -56,11 +56,6 @@ def parse_args():
default
=
" "
,
default
=
" "
,
help
=
"The delimiter used to split tokens in source or target sentences. "
help
=
"The delimiter used to split tokens in source or target sentences. "
"For EN-DE BPE data we provided, use spaces as token delimiter. "
)
"For EN-DE BPE data we provided, use spaces as token delimiter. "
)
parser
.
add_argument
(
"--use_mem_opt"
,
type
=
ast
.
literal_eval
,
default
=
True
,
help
=
"The flag indicating whether to use memory optimization."
)
parser
.
add_argument
(
parser
.
add_argument
(
"--use_py_reader"
,
"--use_py_reader"
,
type
=
ast
.
literal_eval
,
type
=
ast
.
literal_eval
,
...
@@ -212,9 +207,6 @@ def fast_infer(args):
...
@@ -212,9 +207,6 @@ def fast_infer(args):
# This is used here to set dropout to the test mode.
# This is used here to set dropout to the test mode.
infer_program
=
fluid
.
default_main_program
().
clone
(
for_test
=
True
)
infer_program
=
fluid
.
default_main_program
().
clone
(
for_test
=
True
)
if
args
.
use_mem_opt
:
fluid
.
memory_optimize
(
infer_program
)
if
InferTaskConfig
.
use_gpu
:
if
InferTaskConfig
.
use_gpu
:
place
=
fluid
.
CUDAPlace
(
0
)
place
=
fluid
.
CUDAPlace
(
0
)
dev_count
=
fluid
.
core
.
get_cuda_device_count
()
dev_count
=
fluid
.
core
.
get_cuda_device_count
()
...
...
PaddleNLP/unarchived/neural_machine_translation/transformer/profile.py
浏览文件 @
a0e73bf7
...
@@ -81,11 +81,6 @@ def parse_args():
...
@@ -81,11 +81,6 @@ def parse_args():
default
=
" "
,
default
=
" "
,
help
=
"The delimiter used to split tokens in source or target sentences. "
help
=
"The delimiter used to split tokens in source or target sentences. "
"For EN-DE BPE data we provided, use spaces as token delimiter."
)
"For EN-DE BPE data we provided, use spaces as token delimiter."
)
parser
.
add_argument
(
"--use_mem_opt"
,
type
=
ast
.
literal_eval
,
default
=
True
,
help
=
"The flag indicating whether to use memory optimization."
)
parser
.
add_argument
(
parser
.
add_argument
(
"--use_py_reader"
,
"--use_py_reader"
,
type
=
ast
.
literal_eval
,
type
=
ast
.
literal_eval
,
...
@@ -162,9 +157,6 @@ def main(args):
...
@@ -162,9 +157,6 @@ def main(args):
epsilon
=
TrainTaskConfig
.
eps
)
epsilon
=
TrainTaskConfig
.
eps
)
optimizer
.
minimize
(
avg_cost
)
optimizer
.
minimize
(
avg_cost
)
if
args
.
use_mem_opt
:
fluid
.
memory_optimize
(
train_prog
)
if
TrainTaskConfig
.
use_gpu
:
if
TrainTaskConfig
.
use_gpu
:
place
=
fluid
.
CUDAPlace
(
0
)
place
=
fluid
.
CUDAPlace
(
0
)
dev_count
=
fluid
.
core
.
get_cuda_device_count
()
dev_count
=
fluid
.
core
.
get_cuda_device_count
()
...
...
PaddleNLP/unarchived/neural_machine_translation/transformer/train.py
浏览文件 @
a0e73bf7
...
@@ -113,11 +113,6 @@ def parse_args():
...
@@ -113,11 +113,6 @@ def parse_args():
default
=
False
,
default
=
False
,
help
=
"The flag indicating whether to run the task "
help
=
"The flag indicating whether to run the task "
"for continuous evaluation."
)
"for continuous evaluation."
)
parser
.
add_argument
(
"--use_mem_opt"
,
type
=
ast
.
literal_eval
,
default
=
True
,
help
=
"The flag indicating whether to use memory optimization."
)
parser
.
add_argument
(
parser
.
add_argument
(
"--use_py_reader"
,
"--use_py_reader"
,
type
=
ast
.
literal_eval
,
type
=
ast
.
literal_eval
,
...
@@ -682,9 +677,6 @@ def train(args):
...
@@ -682,9 +677,6 @@ def train(args):
optimizer
=
fluid
.
optimizer
.
SGD
(
0.003
)
optimizer
=
fluid
.
optimizer
.
SGD
(
0.003
)
optimizer
.
minimize
(
avg_cost
)
optimizer
.
minimize
(
avg_cost
)
if
args
.
use_mem_opt
:
fluid
.
memory_optimize
(
train_prog
)
if
args
.
local
:
if
args
.
local
:
logging
.
info
(
"local start_up:"
)
logging
.
info
(
"local start_up:"
)
train_loop
(
exe
,
train_prog
,
startup_prog
,
dev_count
,
sum_cost
,
avg_cost
,
train_loop
(
exe
,
train_prog
,
startup_prog
,
dev_count
,
sum_cost
,
avg_cost
,
...
...
PaddleSpeech/DeepASR/train.py
浏览文件 @
a0e73bf7
...
@@ -174,7 +174,6 @@ def train(args):
...
@@ -174,7 +174,6 @@ def train(args):
decay_rate
=
1
/
1.2
,
decay_rate
=
1
/
1.2
,
staircase
=
True
))
staircase
=
True
))
optimizer
.
minimize
(
avg_cost
)
optimizer
.
minimize
(
avg_cost
)
fluid
.
memory_optimize
(
train_program
)
test_program
=
fluid
.
Program
()
test_program
=
fluid
.
Program
()
test_startup
=
fluid
.
Program
()
test_startup
=
fluid
.
Program
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录