Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Auto parallel] Mixed Precision FP16 Pass #40615

Merged
merged 33 commits into from
Mar 28, 2022

Conversation

JZ-LIANG
Copy link
Contributor

@JZ-LIANG JZ-LIANG commented Mar 16, 2022

PR types

New features

PR changes

Others

Describe

Add Mixed Precision FP16 Pass for Auto parallel

Test on GPT-medium model with bsz = 16 x 512, V100 32G

  速度 token/s 显存 MB
Baseline 4489 27545
AMP Pass (O1) 11898 19823
FP16 Pass (O2) 12976 18668
FP16 Pass (O3) 13235 16693

Usage

        dist_strategy = fleet.DistributedStrategy()
        dist_strategy.amp =True
        white_list = ['gelu']
        black_list = ['layer_norm', 'softmax'] 
        dist_strategy.amp_configs = {
            "custom_white_list": white_list,
            "custom_black_list": black_list,
            "init_loss_scaling": 32768,
            "use_dynamic_loss_scaling": True,
            "use_pure_fp16": True, # True to enable O2 level
            "use_optimizer_fp16": True,  # True to enable O3 level
        }

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@JZ-LIANG JZ-LIANG requested a review from aoyulong March 25, 2022 05:27
@JZ-LIANG JZ-LIANG changed the title [Auto parallel] Mixed Precision FP16 Pass [Auto parallel] Support Mixed Precision FP16 Pass Mar 25, 2022
@JZ-LIANG JZ-LIANG changed the title [Auto parallel] Support Mixed Precision FP16 Pass [Auto parallel] Mixed Precision FP16 Pass Mar 25, 2022
Copy link
Contributor

@aoyulong aoyulong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@JZ-LIANG JZ-LIANG merged commit b99c1d0 into PaddlePaddle:develop Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants