Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Oneflow-Inc
OneFlow-Benchmark
提交
6a2e74fa
O
OneFlow-Benchmark
项目概览
Oneflow-Inc
/
OneFlow-Benchmark
上一次同步 接近 3 年
通知
1
Star
92
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
OneFlow-Benchmark
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6a2e74fa
编写于
10月 06, 2020
作者:
O
ouyangyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add optimization parameters
上级
2f68c17c
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
131 addition
and
8 deletion
+131
-8
Classification/cnns/benchmark.sh
Classification/cnns/benchmark.sh
+1
-0
Classification/cnns/config.py
Classification/cnns/config.py
+2
-1
Classification/cnns/job_function_util.py
Classification/cnns/job_function_util.py
+4
-0
Classification/cnns/ofrecord_util.py
Classification/cnns/ofrecord_util.py
+9
-4
Classification/cnns/train.sh
Classification/cnns/train.sh
+13
-3
Classification/cnns/train_fp16.sh
Classification/cnns/train_fp16.sh
+52
-0
Classification/cnns/train_fp32.sh
Classification/cnns/train_fp32.sh
+50
-0
未找到文件。
Classification/cnns/benchmark.sh
浏览文件 @
6a2e74fa
...
...
@@ -44,4 +44,5 @@ python3 $BENCH_ROOT/of_cnn_train_val.py \
--fuse_bn_add_relu
=
True
\
--nccl_fusion_threshold_mb
=
16
\
--nccl_fusion_max_ops
=
24
\
--bytes_decoder
=
True
\
--model
=
"resnet50"
Classification/cnns/config.py
浏览文件 @
6a2e74fa
...
...
@@ -111,7 +111,8 @@ def get_parser(parser=None):
default
=
False
,
help
=
'Whether to use use fuse batch normalization add relu. Currently supported in origin/master of OneFlow only.'
)
parser
.
add_argument
(
"--bytes_decoder"
,
type
=
str2bool
,
default
=
False
,
help
=
'Whether to use use ImageDecoderRandomCropResize.'
)
# inference
parser
.
add_argument
(
"--image_path"
,
type
=
str
,
default
=
'test_img/tiger.jpg'
,
help
=
"image path"
)
...
...
Classification/cnns/job_function_util.py
浏览文件 @
6a2e74fa
...
...
@@ -35,6 +35,10 @@ def get_train_config(args):
train_config
.
prune_parallel_cast_ops
(
True
)
train_config
.
enable_inplace
(
True
)
if
args
.
num_nodes
>
1
:
train_config
.
cudnn_conv_heuristic_search_algo
(
True
)
else
:
train_config
.
cudnn_conv_heuristic_search_algo
(
False
)
train_config
.
enable_fuse_model_update_ops
(
True
)
return
train_config
...
...
Classification/cnns/ofrecord_util.py
浏览文件 @
6a2e74fa
...
...
@@ -90,14 +90,19 @@ def load_imagenet_for_training(args):
part_name_suffix_length
=
5
,
random_shuffle
=
True
,
shuffle_after_epoch
=
True
)
image
=
flow
.
data
.
OFRecordImageDecoderRandomCrop
(
ofrecord
,
"encoded"
,
# seed=seed,
color_space
=
color_space
)
label
=
flow
.
data
.
OFRecordRawDecoder
(
ofrecord
,
"class/label"
,
shape
=
(),
dtype
=
flow
.
int32
)
if
args
.
bytes_decoder
:
encoded
=
flow
.
data
.
OFRecordBytesDecoder
(
ofrecord
,
"encoded"
)
image
=
flow
.
data
.
ImageDecoderRandomCropResize
(
encoded
,
target_width
=
224
,
target_height
=
224
,
num_workers
=
3
)
else
:
image
=
flow
.
data
.
OFRecordImageDecoderRandomCrop
(
ofrecord
,
"encoded"
,
# seed=seed,
color_space
=
color_space
)
rsz
=
flow
.
image
.
Resize
(
image
,
target_size
=
[
args
.
image_size
,
args
.
image_size
])
image
=
rsz
[
0
]
rsz
=
flow
.
image
.
Resize
(
image
,
target_size
=
[
args
.
image_size
,
args
.
image_size
])
rng
=
flow
.
random
.
CoinFlip
(
batch_size
=
train_batch_size
)
# , seed=seed)
normal
=
flow
.
image
.
CropMirrorNormalize
(
rsz
[
0
]
,
mirror_blob
=
rng
,
normal
=
flow
.
image
.
CropMirrorNormalize
(
image
,
mirror_blob
=
rng
,
color_space
=
color_space
,
output_layout
=
output_layout
,
mean
=
args
.
rgb_mean
,
std
=
args
.
rgb_std
,
output_dtype
=
flow
.
float
)
return
label
,
normal
...
...
Classification/cnns/train.sh
浏览文件 @
6a2e74fa
...
...
@@ -20,6 +20,11 @@ LOG_FOLDER=../logs
mkdir
-p
$LOG_FOLDER
LOGFILE
=
$LOG_FOLDER
/resnet_training.log
export
PYTHONUNBUFFERED
=
1
echo
PYTHONUNBUFFERED
=
$PYTHONUNBUFFERED
export
NCCL_LAUNCH_MODE
=
PARALLEL
echo
NCCL_LAUNCH_MODE
=
$NCCL_LAUNCH_MODE
python3 of_cnn_train_val.py
\
--train_data_dir
=
$DATA_ROOT
/train
\
--train_data_part_num
=
256
\
...
...
@@ -30,11 +35,16 @@ python3 of_cnn_train_val.py \
--optimizer
=
"sgd"
\
--momentum
=
0.875
\
--label_smoothing
=
0.1
\
--learning_rate
=
1.024
\
--learning_rate
=
0.968
\
--loss_print_every_n_iter
=
100
\
--batch_size_per_device
=
128
\
--batch_size_per_device
=
64
\
--val_batch_size_per_device
=
50
\
--channel_last
=
False
\
--fuse_bn_relu
=
True
\
--fuse_bn_add_relu
=
True
\
--nccl_fusion_threshold_mb
=
16
\
--nccl_fusion_max_ops
=
24
\
--num_epoch
=
$NUM_EPOCH
\
--model
=
"resnet50"
2>&1 |
tee
${
LOGFILE
}
echo
"Writting log to
${
LOGFILE
}
"
echo
"Writting log to
${
LOGFILE
}
"
\ No newline at end of file
Classification/cnns/train_fp16.sh
0 → 100755
浏览文件 @
6a2e74fa
rm
-rf
core.
*
rm
-rf
./output/snapshots/
*
if
[
-n
"
$1
"
]
;
then
NUM_EPOCH
=
$1
else
NUM_EPOCH
=
50
fi
echo
NUM_EPOCH
=
$NUM_EPOCH
# training with imagenet
if
[
-n
"
$2
"
]
;
then
DATA_ROOT
=
$2
else
DATA_ROOT
=
/data/imagenet/ofrecord
fi
echo
DATA_ROOT
=
$DATA_ROOT
LOG_FOLDER
=
../logs
mkdir
-p
$LOG_FOLDER
LOGFILE
=
$LOG_FOLDER
/resnet_training.log
export
PYTHONUNBUFFERED
=
1
echo
PYTHONUNBUFFERED
=
$PYTHONUNBUFFERED
export
NCCL_LAUNCH_MODE
=
PARALLEL
echo
NCCL_LAUNCH_MODE
=
$NCCL_LAUNCH_MODE
python3 of_cnn_train_val.py
\
--train_data_dir
=
$DATA_ROOT
/train
\
--train_data_part_num
=
256
\
--val_data_dir
=
$DATA_ROOT
/validation
\
--val_data_part_num
=
256
\
--num_nodes
=
1
\
--gpu_num_per_node
=
8
\
--optimizer
=
"sgd"
\
--momentum
=
0.875
\
--label_smoothing
=
0.1
\
--learning_rate
=
1.024
\
--loss_print_every_n_iter
=
100
\
--batch_size_per_device
=
128
\
--val_batch_size_per_device
=
50
\
--use_fp16
\
--channel_last
=
True
\
--pad_output
\
--fuse_bn_relu
=
True
\
--fuse_bn_add_relu
=
True
\
--nccl_fusion_threshold_mb
=
16
\
--nccl_fusion_max_ops
=
24
\
--num_epoch
=
$NUM_EPOCH
\
--model
=
"resnet50"
2>&1 |
tee
${
LOGFILE
}
echo
"Writting log to
${
LOGFILE
}
"
Classification/cnns/train_fp32.sh
0 → 100755
浏览文件 @
6a2e74fa
rm
-rf
core.
*
rm
-rf
./output/snapshots/
*
if
[
-n
"
$1
"
]
;
then
NUM_EPOCH
=
$1
else
NUM_EPOCH
=
50
fi
echo
NUM_EPOCH
=
$NUM_EPOCH
# training with imagenet
if
[
-n
"
$2
"
]
;
then
DATA_ROOT
=
$2
else
DATA_ROOT
=
/data/imagenet/ofrecord
fi
echo
DATA_ROOT
=
$DATA_ROOT
LOG_FOLDER
=
../logs
mkdir
-p
$LOG_FOLDER
LOGFILE
=
$LOG_FOLDER
/resnet_training.log
export
PYTHONUNBUFFERED
=
1
echo
PYTHONUNBUFFERED
=
$PYTHONUNBUFFERED
export
NCCL_LAUNCH_MODE
=
PARALLEL
echo
NCCL_LAUNCH_MODE
=
$NCCL_LAUNCH_MODE
python3 of_cnn_train_val.py
\
--train_data_dir
=
$DATA_ROOT
/train
\
--train_data_part_num
=
256
\
--val_data_dir
=
$DATA_ROOT
/validation
\
--val_data_part_num
=
256
\
--num_nodes
=
1
\
--gpu_num_per_node
=
8
\
--optimizer
=
"sgd"
\
--momentum
=
0.875
\
--label_smoothing
=
0.1
\
--learning_rate
=
0.968
\
--loss_print_every_n_iter
=
100
\
--batch_size_per_device
=
64
\
--val_batch_size_per_device
=
50
\
--channel_last
=
False
\
--fuse_bn_relu
=
True
\
--fuse_bn_add_relu
=
True
\
--nccl_fusion_threshold_mb
=
16
\
--nccl_fusion_max_ops
=
24
\
--num_epoch
=
$NUM_EPOCH
\
--model
=
"resnet50"
2>&1 |
tee
${
LOGFILE
}
echo
"Writting log to
${
LOGFILE
}
"
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录