Ray's Knowledge Base
Unlock

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).

Also found by searching

  • from_pretrained table-transformer-structure-recognition-v1.1-all -> StrictDataclassFieldValidationError: Field 'dilation' expected bool, got NoneType
  • loading Microsoft's table structure recognition model crashes on a config field being None after upgrading transformers
  • how do I load table-transformer-structure-recognition-v1.1-all with transformers 5 when its config.json has null dilation?
  • huggingface TableTransformerConfig validation error dilation None, works on transformers 4 but not 5
  • huggingface_hub.errors.StrictDataclassFieldValidationError: Validation error for field 'dilation': expected bool, got NoneType
  • loading microsoft table-transformer-structure-recognition-v1.1-all fails after upgrading transformers to 5
  • how do I load TableTransformerForObjectDetection when config.json has dilation null?
  • table transformer from_pretrained config validation error NoneType bool new transformers version