diff --git a/docs/en/quick_start/quick_start_classification_professional_en.md b/docs/en/quick_start/quick_start_classification_professional_en.md index 10c2174063c9914ac2f97c03ce5bb789a116a9d9..840643aafe4e9d432331910fabbb42978105e645 100644 --- a/docs/en/quick_start/quick_start_classification_professional_en.md +++ b/docs/en/quick_start/quick_start_classification_professional_en.md @@ -75,9 +75,23 @@ python3 -m paddle.distributed.launch \ The highest accuracy of the validation set is around 0.415. -* ** Note** +Here, multiple GPUs are used for training. If only one GPU is used, please specify the GPU with the `CUDA_VISIBLE_DEVICES` setting, and specify the GPU with the `--gpus` setting, the same below. For example, to train with only GPU 0: + +```shell +export CUDA_VISIBLE_DEVICES=0 +python3 -m paddle.distributed.launch \ + --gpus="0" \ + tools/train.py \ + -c ./ppcls/configs/quick_start/professional/ResNet50_vd_CIFAR100.yaml \ + -o Global.output_dir="output_CIFAR" \ + -o Optimizer.lr.learning_rate=0.01 +``` + +* **Notice**: + +* The GPUs specified in `--gpus` can be a subset of the GPUs specified in `CUDA_VISIBLE_DEVICES`. +* Since the initial learning rate and batch-size need to maintain a linear relationship, when training is switched from 4 GPUs to 1 GPU, the total batch-size is reduced to 1/4 of the original, and the learning rate also needs to be reduced to 1/4 of the original, so changed the default learning rate from 0.04 to 0.01. - * If the number of GPU cards is not 4, the accuracy of the validation set may be different from 0.415. To maintain a comparable accuracy, you need to change the learning rate in the configuration file to `the current learning rate / 4 \* current card number`. The same below. diff --git a/docs/zh_CN/quick_start/quick_start_classification_professional.md b/docs/zh_CN/quick_start/quick_start_classification_professional.md index 4564b059f54034db346c9ae03d4bc2cbb8a8a1e4..9a44d939ce999e291120c006801b374d302ab8ba 100644 --- a/docs/zh_CN/quick_start/quick_start_classification_professional.md +++ b/docs/zh_CN/quick_start/quick_start_classification_professional.md @@ -75,9 +75,22 @@ python3 -m paddle.distributed.launch \ 验证集的最高准确率为 0.415 左右。 -* **注意** +此处使用了多个 GPU 训练,如果只使用一个 GPU,请将 `CUDA_VISIBLE_DEVICES` 设置指定 GPU,`--gpus`设置指定 GPU,下同。例如,只使用 0 号 GPU 训练: + +```shell +export CUDA_VISIBLE_DEVICES=0 +python3 -m paddle.distributed.launch \ + --gpus="0" \ + tools/train.py \ + -c ./ppcls/configs/quick_start/professional/ResNet50_vd_CIFAR100.yaml \ + -o Global.output_dir="output_CIFAR" \ + -o Optimizer.lr.learning_rate=0.01 +``` + +* **注意**: - * 如果 GPU 卡数不是 4,验证集的准确率可能与 0.415 有差异,若需保持相当的准确率,需要将配置文件中的学习率改为`当前学习率 / 4 \* 当前卡数`。下同。 +* `--gpus`中指定的 GPU 可以是 `CUDA_VISIBLE_DEVICES` 指定的 GPU 的子集。 +* 由于初始学习率和 batch-size 需要保持线性关系,所以训练从 4 个 GPU 切换到 1 个 GPU 训练时,总 batch-size 缩减为原来的 1/4,学习率也需要缩减为原来的 1/4,所以改变了默认的学习率从 0.04 到 0.01。 @@ -157,7 +170,7 @@ python3 -m paddle.distributed.launch \ * **注意** * 其他数据增广的配置文件可以参考 `ppcls/configs/ImageNet/DataAugment/` 中的配置文件。 - * 训练 CIFAR100 的迭代轮数较少,因此进行训练时,验证集的精度指标可能会有 1% 左右的波动。 +* 训练 CIFAR100 的迭代轮数较少,因此进行训练时,验证集的精度指标可能会有 1% 左右的波动。