Getting an error when using the inference API

#1
by penguoir - opened

When uploading an image to the inference API, I get the following error: Size must contain 'height' and 'width' keys or 'shortest_edge' and 'longest_edge' keys. Got dict_keys(['longest_edge']).

Is this something to do with preprocesser.json?

Microsoft org

cc @nielsr

After loading the processor, I just added this line, and it solved the problem
processor.size['shortest_edge'] = 800

from transformers import AutoImageProcessor

processor = AutoImageProcessor.from_pretrained("microsoft/table-transformer-structure-recognition-v1.1-pub")

In the config file, you have to define either width and height or shortest_edge and longest_edge

Hi, I'll look into this, thanks for reporting. Note that the newer checkpoints like this one require a different image preprocessing, see here for details: https://github.com/microsoft/table-transformer/blob/16d124f616109746b7785f03085100f1f6247575/src/inference.py#L45

Demo has also the same issue. Could you fix it @nielsr ?

Sign up or log in to comment