Commit 74589e6
authored
Fix Backward Compatibility for Convergence Test (#1078)
## Summary
<!--- This is a required section; please describe the main purpose of
this proposed code change. --->
This PR restores backward compatibility for convergence tests with
transformers v4 (v4.49.0 ~ v4.57.6). During the initial development
phase for transformers v5 support, backward compatibility was
intentionally deprioritized, leading to significant test regressions.
This PR fixes those regressions while maintaining a stable foundation
for the ongoing v5 integration.
## Related Issues & PRs
- #978
- #994
## Details
The current codebase assumes transformers v5 conventions, which broke
compatibility with the v4.x series in two major areas:
1. RoPE Parameters: Some model miss some rope parameters
(`rope_scaling`) since they are unified to `rope_parameters` in
transformer v5.
2. Tokenizer Consistency: v5 and v4 handle the Tokenizer interfaces
differently. V5's Tokenizer will select the appropriate backend, while
v4's Tokenizer is the python-based implementation using SentencePiece as
backend.
Key Fixes:
- Added conditional logic to provide different rope parameters for
different transformers versions.
- Enforced TokenizerFast usage for transformers < v5 to resolve
interface mismatches.
## Testing Done
<!--- This is a required section; please describe how this change was
tested. --->
I ran `python -m pytest test/convergence/*` on different versions of
transformers on the original branch and after making changes. The result
is shown below:
| Branches| v4.49.0 | v4.57.6 | v5.0.0 |
|---|---|---|---|
| transformer-5.0.0rc1 | 8 failed, 37 passed, 98 skipped, 1 warning | 42
failed, 92 passed, 9 skipped, 3 warnings| 19 failed, 115 passed, 9
skipped, 29 warnings |
| This PR | 0 failed, 45 passed, 98 skipped, 1 warning | 0 failed, 134
passed, 9 skipped, 19 warnings | 19 failed, 115 passed, 9 skipped, 29
warnings |
All of the failed tests in v5 are inspected carefully that all of them
are identical to the previously thrown error.
</div></b>
<!--
Replace BLANK with your device type. For example, A100-80G-PCIe
Complete the following tasks before sending your PR, and replace `[ ]`
with
`[x]` to indicate you have done them.
-->
- Hardware Type: H100
- [x] run `make test` to ensure correctness
- [x] run `make checkstyle` to ensure code style
- [x] run `make test-convergence` to ensure convergence1 parent e6fdedc commit 74589e6
File tree
6 files changed
+270
-47
lines changed- test/convergence
- bf16
- fp32
6 files changed
+270
-47
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
53 | 55 | | |
54 | 56 | | |
55 | 57 | | |
| 58 | + | |
56 | 59 | | |
57 | 60 | | |
58 | 61 | | |
| |||
94 | 97 | | |
95 | 98 | | |
96 | 99 | | |
| 100 | + | |
| 101 | + | |
97 | 102 | | |
98 | 103 | | |
99 | 104 | | |
| |||
307 | 312 | | |
308 | 313 | | |
309 | 314 | | |
310 | | - | |
311 | 315 | | |
312 | 316 | | |
313 | 317 | | |
| |||
702 | 706 | | |
703 | 707 | | |
704 | 708 | | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
705 | 719 | | |
706 | 720 | | |
707 | 721 | | |
| |||
728 | 742 | | |
729 | 743 | | |
730 | 744 | | |
731 | | - | |
732 | | - | |
733 | | - | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
734 | 750 | | |
735 | 751 | | |
736 | 752 | | |
| |||
779 | 795 | | |
780 | 796 | | |
781 | 797 | | |
782 | | - | |
783 | | - | |
784 | | - | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
785 | 803 | | |
786 | 804 | | |
787 | 805 | | |
| |||
839 | 857 | | |
840 | 858 | | |
841 | 859 | | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
842 | 866 | | |
843 | 867 | | |
844 | 868 | | |
| |||
893 | 917 | | |
894 | 918 | | |
895 | 919 | | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
896 | 926 | | |
897 | 927 | | |
898 | 928 | | |
| |||
1129 | 1159 | | |
1130 | 1160 | | |
1131 | 1161 | | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
1132 | 1167 | | |
1133 | 1168 | | |
1134 | 1169 | | |
| |||
1199 | 1234 | | |
1200 | 1235 | | |
1201 | 1236 | | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
1202 | 1242 | | |
1203 | 1243 | | |
1204 | 1244 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | | - | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
52 | 61 | | |
53 | 62 | | |
54 | 63 | | |
55 | 64 | | |
56 | 65 | | |
57 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
58 | 71 | | |
59 | 72 | | |
60 | 73 | | |
| |||
70 | 83 | | |
71 | 84 | | |
72 | 85 | | |
73 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
74 | 91 | | |
75 | 92 | | |
76 | 93 | | |
| |||
82 | 99 | | |
83 | 100 | | |
84 | 101 | | |
85 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
86 | 106 | | |
87 | 107 | | |
88 | 108 | | |
| |||
138 | 158 | | |
139 | 159 | | |
140 | 160 | | |
141 | | - | |
142 | 161 | | |
143 | 162 | | |
144 | 163 | | |
| |||
209 | 228 | | |
210 | 229 | | |
211 | 230 | | |
212 | | - | |
213 | 231 | | |
214 | 232 | | |
215 | 233 | | |
| |||
314 | 332 | | |
315 | 333 | | |
316 | 334 | | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
317 | 344 | | |
318 | 345 | | |
319 | 346 | | |
| |||
491 | 518 | | |
492 | 519 | | |
493 | 520 | | |
494 | | - | |
495 | | - | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
496 | 525 | | |
497 | 526 | | |
498 | 527 | | |
| |||
663 | 692 | | |
664 | 693 | | |
665 | 694 | | |
666 | | - | |
667 | | - | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
668 | 699 | | |
669 | 700 | | |
670 | 701 | | |
| |||
723 | 754 | | |
724 | 755 | | |
725 | 756 | | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
726 | 763 | | |
727 | 764 | | |
728 | 765 | | |
| |||
770 | 807 | | |
771 | 808 | | |
772 | 809 | | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
773 | 816 | | |
774 | 817 | | |
775 | 818 | | |
| |||
0 commit comments