Repository navigation
Commit 98c2948
authored
Fix compiled refits with empty table schemas (#1241)
# Summary
Fix compiled processor refits that produce an empty table schema.
Preserve the selected column names and semantic types while making
constructor metadata safe to emit in captured graphs.
# Description of the change
On PyTorch 2.14.0, Python 3.12.14, CPU/macOS, this public SDM workflow
fails on the third refit:
```python
import torch
from sdm import TableTensor
from sdm.processing import DropConstantColumns
processor = DropConstantColumns()
fit_transform = torch.compile(
processor.fit_transform, backend="eager", fullgraph=False
)
for data in (
torch.ones(3, 3),
torch.arange(9, dtype=torch.float32).reshape(3, 3),
torch.ones(3, 3),
):
fit_transform(TableTensor.from_tensor(data))
```
The generated constructor call contains enum keys such as
`Stype.numerical` without binding `Stype`, raising `NameError: name
'Stype' is not defined`.
Pass semantic type keys as their string values across the opaque
table-constructor boundary, then restore the enum keys inside the
constructor. This preserves the public schema and fixes the permissive
compilation refit failure; strict fullgraph fitting with value-dependent
column selection remains separate.
# Validation
- Table and constant-column suites: 63 passed, 14 skipped on CPU PyTorch
2.14.0.
- External reproduction fails on unchanged main and passes with this
change.
- Repeated public refits with eager and Inductor backends preserve
empty, nonempty, and zero-width output schemas.
- Changed-file pre-commit checks passed, including formatting and type
checking.1 parent 05a88d9 commit 98c2948
1 file changed
Lines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
| 341 | + | |
341 | 342 | | |
342 | | - | |
| 343 | + | |
343 | 344 | | |
344 | 345 | | |
345 | 346 | | |
| |||
352 | 353 | | |
353 | 354 | | |
354 | 355 | | |
355 | | - | |
| 356 | + | |
356 | 357 | | |
357 | 358 | | |
358 | 359 | | |
| |||
361 | 362 | | |
362 | 363 | | |
363 | 364 | | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
364 | 368 | | |
365 | 369 | | |
366 | | - | |
| 370 | + | |
367 | 371 | | |
368 | 372 | | |
369 | 373 | | |
| |||
378 | 382 | | |
379 | 383 | | |
380 | 384 | | |
381 | | - | |
| 385 | + | |
382 | 386 | | |
383 | 387 | | |
384 | 388 | | |
| |||
0 commit comments