table-transformer-structure-recognition-v1.1-all (ONNX)

Converted and published by KavayaM Technologies.

An ONNX export of microsoft/table-transformer-structure-recognition-v1.1-all, for direct execution via onnxruntime, with no PyTorch installation required.

Source model and license

Weights are unmodified from the source model above, trained by Microsoft on PubTables-1M and FinTabNet.c (Smock et al., 2023). This repository only adds the ONNX export -- no fine-tuning, no weight changes. MIT-licensed, same as the source model.

Conversion

Exported via torch.onnx.export(), opset 15, using the legacy (non-dynamo) exporter. The dynamo-based exporter (dynamo=True, default on current PyTorch) fails on this model with a version-conversion error (No Adapter To Version $17 for Resize) when targeting opset 15; the legacy exporter's native per-opset op emission does not hit this issue.

Verification

Compared against the live PyTorch model's raw output (pred_logits/pred_boxes) on a single real table-image crop, maximum absolute difference:

pred_logits pred_boxes
CPU (onnxruntime CPUExecutionProvider) 0.000029 0.000002
GPU (onnxruntime CUDAExecutionProvider, NVIDIA_TF32_OVERRIDE=0) 0.000027 0.000003

Both within ordinary floating-point export/inference noise. The GPU figure requires NVIDIA_TF32_OVERRIDE=0 -- without it, GPUs that default to TF32 (Ampere/Ada/Hopper) show a substantially larger difference from reduced-precision matmul, unrelated to export correctness.

This checks raw tensor output only, on one input. It does not benchmark accuracy or speed on any particular document set -- those depend on the documents in question, not on a property of this file.

Files

  • model.onnx -- the exported graph
  • model.onnx.data -- externalized weights (required alongside model.onnx; ONNX externalizes weights above a size threshold into this companion file)

Usage

from huggingface_hub import hf_hub_download
import onnxruntime as ort

onnx_path = hf_hub_download(
    repo_id="kavayam/table-transformer-structure-recognition-v1.1-all-onnx",
    filename="model.onnx",
)
hf_hub_download(
    repo_id="kavayam/table-transformer-structure-recognition-v1.1-all-onnx",
    filename="model.onnx.data",
)  # must be downloaded alongside model.onnx, in the same directory

session = ort.InferenceSession(onnx_path, providers=["CPUExecutionProvider"])
# Input: "pixel_values", a (1, 3, H, W) float32 array, ImageNet-normalized
# after resizing the longer side to 1000px -- see Microsoft's reference
# implementation (https://github.com/microsoft/table-transformer/blob/main/src/inference.py,
# structure_transform) for the exact steps.
pred_logits, pred_boxes = session.run(
    ["pred_logits", "pred_boxes"], {"pixel_values": pixel_values}
)
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for kavayam/table-transformer-structure-recognition-v1.1-all-onnx

Paper for kavayam/table-transformer-structure-recognition-v1.1-all-onnx