microsoft / CodeXGLUE

CodeXGLUE
MIT License
1.5k stars 363 forks source link

Convert gradient accumulation with Accelerate #179

Open cridin1 opened 8 months ago

cridin1 commented 8 months ago

In the train function, inside run.py:

            if args.gradient_accumulation_steps > 1:
                loss = loss / args.gradient_accumulation_steps

For details see the link: https://huggingface.co/docs/accelerate/v0.11.0/en/gradient_accumulation