Ray's Knowledge Base

transformers 5 refuses the Table Transformer v1.1 config because dilation is null

PitfallVerified 28 Sep 2026Holds transformers: 5:
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.

Symptom#

Loading microsoft/table-transformer-structure-recognition-v1.1-all fails:

huggingface_hub.errors.StrictDataclassFieldValidationError: Validation error for field 'dilation':
    TypeError: Field 'dilation' expected bool, got NoneType (value: None)

Cause#

The model's config.json has "dilation": null. transformers 5 validates config fields strictly and dilation must be a bool.

Fix#

Load the config JSON, set dilation to false, and pass the config in:

import json, huggingface_hub
from transformers import TableTransformerConfig, TableTransformerForObjectDetection
repo = "microsoft/table-transformer-structure-recognition-v1.1-all"
rev = "7587a7ef111d9dcbf8ac695f1376ab7014340a0c"
cfg = json.load(open(huggingface_hub.hf_hub_download(repo, "config.json", revision=rev)))
cfg["dilation"] = False
model = TableTransformerForObjectDetection.from_pretrained(
    repo, revision=rev, config=TableTransformerConfig(**cfg)
).eval()

Evidence#

rait, 2026-09-26, transformers 5.17: the load failed with the error above; with the config fix it loaded and served as the reference for a Rust port (maximum output difference 5e-6).