提交 28db32b7 编写于 作者: L LielinJiang 提交者: qingqing01

Add use_multiprocessing argument (#3196)

上级 5456de27
...@@ -65,6 +65,8 @@ python ./train.py \ ...@@ -65,6 +65,8 @@ python ./train.py \
--save_weights_path=$SAVE_WEIGHTS_PATH \ --save_weights_path=$SAVE_WEIGHTS_PATH \
--dataset_path=$DATASET_PATH --dataset_path=$DATASET_PATH
``` ```
注意:如果在windows系统上进行训练请不要将use_multiprocessing设置为True
使用以下命令获得更多使用说明: 使用以下命令获得更多使用说明:
``` ```
python train.py --help python train.py --help
......
...@@ -68,6 +68,7 @@ add_arg('memory_optimize', bool, True, "Using memory optimizer.") ...@@ -68,6 +68,7 @@ add_arg('memory_optimize', bool, True, "Using memory optimizer.")
add_arg('norm_type', str, 'bn', "Normalization type, should be 'bn' or 'gn'.") add_arg('norm_type', str, 'bn', "Normalization type, should be 'bn' or 'gn'.")
add_arg('profile', bool, False, "Enable profiler.") add_arg('profile', bool, False, "Enable profiler.")
add_arg('use_py_reader', bool, True, "Use py reader.") add_arg('use_py_reader', bool, True, "Use py reader.")
add_arg('use_multiprocessing', bool, False, "Use multiprocessing.")
add_arg("num_workers", int, 8, "The number of python processes used to read and preprocess data.") add_arg("num_workers", int, 8, "The number of python processes used to read and preprocess data.")
parser.add_argument( parser.add_argument(
'--enable_ce', '--enable_ce',
...@@ -227,7 +228,7 @@ if args.use_py_reader: ...@@ -227,7 +228,7 @@ if args.use_py_reader:
batches = dataset.get_batch_generator( batches = dataset.get_batch_generator(
batch_size // fluid.core.get_cuda_device_count(), batch_size // fluid.core.get_cuda_device_count(),
total_step * fluid.core.get_cuda_device_count(), total_step * fluid.core.get_cuda_device_count(),
use_multiprocessing=True, num_workers=args.num_workers) use_multiprocessing=args.use_multiprocessing, num_workers=args.num_workers)
for b in batches: for b in batches:
yield b[0], b[1] yield b[0], b[1]
py_reader.decorate_tensor_provider(data_gen) py_reader.decorate_tensor_provider(data_gen)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册