Commit 853a994
authored
FIX Call super().__post_init__() in CPTConfig and RandLoraConfig (#3365)
CPTConfig and RandLoraConfig override __post_init__ without calling
super().__post_init__(), so PeftConfig.__post_init__ never runs for them.
As a result the peft_version field is left as None (instead of being
auto-filled) and the task_type validation in the base class is skipped.
Every other tuner config that overrides __post_init__ calls super();
add the call (first, matching the convention) so these two behave the
same and record peft_version in their saved adapter_config.json.
Follow-up to adding the missing configs to ALL_CONFIG_CLASSES:
- CPTConfig requires task_type=CAUSAL_LM to construct and only supports that
task type, so pin it in mandatory_kwargs and skip it in the generic
valid/invalid task_type tests (it's still covered by the round-trip tests,
which is what would have caught the original __post_init__ omission).
- OFTConfig's from_pretrained back-compat guard fires before the generic load
path, so skip it in the four from_pretrained-based tests.
All other matrix tests now exercise both configs.1 parent 1ef3b4b commit 853a994
3 files changed
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
| 189 | + | |
189 | 190 | | |
190 | 191 | | |
191 | 192 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| 57 | + | |
| 58 | + | |
56 | 59 | | |
57 | 60 | | |
58 | 61 | | |
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
62 | 65 | | |
| 66 | + | |
63 | 67 | | |
64 | 68 | | |
65 | 69 | | |
| |||
106 | 110 | | |
107 | 111 | | |
108 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
109 | 119 | | |
110 | 120 | | |
111 | 121 | | |
| |||
132 | 142 | | |
133 | 143 | | |
134 | 144 | | |
| 145 | + | |
| 146 | + | |
135 | 147 | | |
136 | 148 | | |
137 | 149 | | |
138 | 150 | | |
139 | 151 | | |
140 | 152 | | |
141 | 153 | | |
| 154 | + | |
| 155 | + | |
142 | 156 | | |
143 | 157 | | |
144 | 158 | | |
| |||
171 | 185 | | |
172 | 186 | | |
173 | 187 | | |
| 188 | + | |
| 189 | + | |
174 | 190 | | |
175 | 191 | | |
176 | 192 | | |
| |||
221 | 237 | | |
222 | 238 | | |
223 | 239 | | |
| 240 | + | |
| 241 | + | |
224 | 242 | | |
225 | 243 | | |
226 | 244 | | |
| |||
239 | 257 | | |
240 | 258 | | |
241 | 259 | | |
| 260 | + | |
| 261 | + | |
242 | 262 | | |
243 | 263 | | |
244 | 264 | | |
| |||
482 | 502 | | |
483 | 503 | | |
484 | 504 | | |
| 505 | + | |
| 506 | + | |
485 | 507 | | |
486 | 508 | | |
487 | 509 | | |
| |||
0 commit comments