From 16509fe34ff01ad3e6088f55300765e4330f8638 Mon Sep 17 00:00:00 2001 From: danleifeng Date: Thu, 13 Feb 2020 07:59:44 +0000 Subject: [PATCH] update fp16 training script --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b66a7bf..3a2692f 100644 --- a/README.md +++ b/README.md @@ -493,14 +493,18 @@ python tools/process_base64_files.py --data_dir=./dataset --file_list=file_list. PLSC支持混合精度训练。使用混合精度训练可以提升训练的速度,同时减少训练使用的显存开销。 #### 使用指南 可以通过下面的代码设置开启混合精度训练: - -```python -# for speed up +``` export FLAGS_sync_nccl_allreduce=1 export FLAGS_cudnn_exhaustive_search=0 export FLAGS_cudnn_batchnorm_spatial_persistent=1 export FLAGS_eager_delete_tensor_gb=0 +python -m paddle.distributed.launch \ + --log_dir=log \ + train.py +``` +上述train.sh脚本中,设置了一些常用的优化性能的环境变量,详情可参考[分布式GPU训练优秀实践](https://www.paddlepaddle.org.cn/documentation/docs/zh/advanced_usage/best_practice/dist_training_gpu.html)。通过`paddle.distributed.launch`启动的train.py脚本如下: +```python from plsc import Entry def main(): -- GitLab