microsoft / CodeXGLUE

CodeXGLUE
MIT License
1.56k stars 366 forks source link

Convert gradient accumulation with Accelerate #179

Open cridin1 opened 10 months ago

cridin1 commented 10 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