PaddleClas/ppcls/static
Tingquan Gao ab087065e9
support to specify rank to log when using Fleet API (#3039)
* support to specify rank to log when using Fleet API

* log max mem reserved

* log_ranks support str type

example: -o Global.log_ranks="0,1"

* log max mem allocated

* support to specify rank to log in static mode

* log max mem reserved and max mem allocated in static mode
2023-11-16 11:32:29 +08:00
..
README.md add static training doc 2022-12-06 16:31:02 +08:00
program.py support to specify rank to log when using Fleet API (#3039) 2023-11-16 11:32:29 +08:00
run_dali.sh refactor: change params to be consistent with amp 2022-01-25 11:58:07 +08:00
save_load.py remove fluid 2022-05-26 07:40:15 +00:00
train.py support to specify rank to log when using Fleet API (#3039) 2023-11-16 11:32:29 +08:00

README.md

使用静态图模式训练

飞桨框架支持动态图模式和静态图模式通常情况下使用动态图训练即可满足大部分场景需求。飞桨经过多个版本的持续优化动态图模型训练的性能已经可以和静态图媲美。如果在某些场景下确实需要使用静态图模式训练我们推荐优先使用动转静训练功能即仍然采用更易用的动态图方式构建模型再转为静态图模式进行训练。同时考虑到对静态图训练的兼容PaddleClas 同样提供了静态图训练功能。

一、动转静训练

仅需在训练配置文件中设置参数 Global.to_staticTrue,同时通过参数 Global.image_shape 输入数据 shape 即可,如 [3, 224, 224]

二、静态图训练

在 PaddleClas 中,静态图训练与动态图类似,同样使用配置文件的方式指定训练参数,训练入口脚本为 ppcls/static/train.py,以 ResNet50 模型为例,训练启动命令如下:

export CUDA_VISIBLE_DEVICES="0,1,2,3"
python3.7 -m paddle.distributed.launch \
    --gpus="0,1,2,3" \
    ppcls/static/train.py \
    -c ./ppcls/configs/ImageNet/ResNet/ResNet50_amp_O1.yaml