Commit dd383f5
fix: preserve _internal_config during Pydantic deserialization
The _internal_config field was being lost when TrainableModel was
deserialized from JSON (e.g., when sent from client to SkyPilot backend).
This is because Pydantic ignores fields starting with underscore during
model_validate().
Added a model_validator(mode="wrap") that extracts _internal_config from
the input data before validation and sets it after the model is created.
This fixes the "Cannot request more than 0 logprobs" error when using
_internal_config.engine_args with remote backends.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 2c6e4bf commit dd383f5
2 files changed
+27
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
2 | 11 | | |
3 | 12 | | |
4 | 13 | | |
5 | | - | |
| 14 | + | |
6 | 15 | | |
7 | 16 | | |
8 | 17 | | |
| |||
279 | 288 | | |
280 | 289 | | |
281 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
282 | 304 | | |
283 | 305 | | |
284 | 306 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
137 | 139 | | |
138 | 140 | | |
139 | 141 | | |
| |||
0 commit comments