Commit c796862
authored
feat(pd): support gradient accumulation (#4920)
support gradient accumulation for paddle backend.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Configurable gradient accumulation (acc_freq) that batches optimizer
updates, optional gradient clipping, and multi‑GPU gradient sync to
occur at the configured interval; acc_freq=1 preserves prior behavior.
- **Documentation**
- Added argument docs and a Paddle backend notice describing acc_freq.
- **Tests**
- Added tests exercising gradient accumulation and updated test cleanup.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent 996d192 commit c796862
3 files changed
Lines changed: 49 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
136 | 139 | | |
137 | 140 | | |
138 | 141 | | |
| |||
744 | 747 | | |
745 | 748 | | |
746 | 749 | | |
747 | | - | |
748 | 750 | | |
749 | 751 | | |
750 | 752 | | |
| |||
780 | 782 | | |
781 | 783 | | |
782 | 784 | | |
783 | | - | |
784 | | - | |
785 | | - | |
786 | | - | |
787 | | - | |
788 | | - | |
789 | | - | |
790 | | - | |
791 | | - | |
792 | | - | |
793 | | - | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
794 | 792 | | |
795 | 793 | | |
796 | | - | |
797 | | - | |
798 | | - | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
799 | 806 | | |
800 | 807 | | |
801 | 808 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
3167 | 3168 | | |
3168 | 3169 | | |
3169 | 3170 | | |
| 3171 | + | |
3170 | 3172 | | |
3171 | 3173 | | |
3172 | 3174 | | |
| |||
3269 | 3271 | | |
3270 | 3272 | | |
3271 | 3273 | | |
| 3274 | + | |
| 3275 | + | |
| 3276 | + | |
| 3277 | + | |
| 3278 | + | |
| 3279 | + | |
| 3280 | + | |
3272 | 3281 | | |
3273 | 3282 | | |
3274 | 3283 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
154 | 153 | | |
155 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
156 | 172 | | |
157 | 173 | | |
158 | 174 | | |
| |||
0 commit comments