Load Microsoft model

#3
by IronManV8 - opened

Hi @nielsr ,

I have trained TSR model using Microsoft code, now I have the pth file and the config file I used. How can I load the model using HF.

Thanks for the help!

Microsoft org

Hi,

You can use the conversion script for that: https://github.com/huggingface/transformers/blob/main/src/transformers/models/table_transformer/convert_table_transformer_original_pytorch_checkpoint_to_pytorch.py.

However according to this thread there might be a bug in the conversion of the table structure recognition model. Let me know if you see anything weird.

Hi @nielsr ,

I used the code conversion after small changes. I think it's working fine, I haven't seen anything weird yet when infering. Thanks !

Could you please share what you changed ?

Hi, I'm working in a firewalled env and can't use transformers to load model directly. what I did is I downloaded model file manually from Huggingface and then load using model = TableTransformerForObjectDetection.from_pretrained("model_path"), but I encountered the error "LocalEntryNotFoundError: An error happened while trying to locate the file on the Hub and we cannot find the requested files in the local cache. Please check your connection and try again or make sure your Internet connection is on."

how can I load it from my local folder with downloaded model files?

@nielsr , can you suggest what's going on? really need your help

Sign up or log in to comment