Skip to content

TableDetector() crashes with transformers >= 5.x: "Field 'dilation' expected bool, got NoneType" #72

Description

@ofermend

Summary

With transformers 5.x installed, constructing TableDetector() (or AutoTableFormatter()) raises immediately, making gmft unusable:

File ".../gmft/detectors/tatr.py", line 48, in __init__
    self.detector = TableTransformerForObjectDetection.from_pretrained(
...
File ".../huggingface_hub/dataclasses.py", line 146, in __strict_setattr__
    raise StrictDataclassFieldValidationError(field=name, cause=e) from e
huggingface_hub.errors.StrictDataclassFieldValidationError: Validation error for field 'dilation':
    TypeError: Field 'dilation' expected bool, got NoneType (value: None)

Reproduction

from gmft.auto import TableDetector
TableDetector()  # raises

Versions

  • gmft 0.4.2 and 0.4.3 (both affected)
  • transformers 5.8.1 (also reproduced on 5.14.1)
  • huggingface-hub 1.13.0
  • Python 3.12
  • Works fine with transformers 4.57.6

Root cause

transformers 5.x validates model configs with huggingface_hub's strict dataclasses. The microsoft/table-transformer-detection checkpoint's config.json on the Hub contains "dilation": null, which fails the bool field validation inside `from_pretcode runs. The structure-recognition checkpoint loads through the same path.

Why staying on 4.x is problematic

transformers < 5.3.0 / < 5.5.0 carry two high-severity advisories with no 4.x

So projects that upgrade transformers for these fixes lose gmft.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions