microsoft / table-transformer

Table Transformer (TATR) is a deep learning model for extracting tables from unstructured documents (PDFs and images). This is also the official repository for the PubTables-1M dataset and GriTS evaluation metric.
MIT License
2.01k stars 231 forks source link

TSR model export onnx, but does not support dynamic batch #179

Open qrsssh opened 1 month ago

qrsssh commented 1 month ago
 input_names = ["input_ids"]
 output_names =  ['pred_logits', 'pred_boxes']
 a=torch.randn(20,3, 1000, 727)

 dynamic_axes={
                    "input_ids": {0: 'batch', 2: 'input_height', 3: 'input_width'},
                    "pred_logits": {0: 'batch'},
                    "pred_boxes": {0: 'batch'},
                    }

    torch.onnx.export(self.str_model, a, "./a.onnx", verbose=False, do_constant_folding=True, 
                                input_names=input_names, output_names=output_names, 
                                opset_version=12, dynamic_axes=dynamic_axes) 

No errors were reported and the onnx model was exported However, only the same batch size as input is supported during inference.

qrsssh commented 1 month ago

@bsmock @rohithpv