Is there any way to convert TrOCR model to TFLite version? I was trying to convert it to ONNX first with Transformers ONNX, but in the list I only found Vision Encoder Decoder model so kind of wondering about this one. Planning to embed it on mobile device. Also, is there any way to reduce the size of the model that we had trained without losing any accuracy?
I stumbled upon #19604. However, it’s a bit different. In my case, I used the
trainer.save function to save my finetuned TrOCR model. As a result, I got the checkpoint files and also these files:
config.json generation_config.json preprocessor_config.json pytorch_model.bin training_args.bin
Command I used:
python -m transformers.onnx --model=trocr/base/ --feature=vision2seq-lm onnx/ --atol 1e-3
Error that I still got:
ValueError: Unrecognized feature extractor in trocr/base/. Should have a `feature_extractor_type` key in its preprocessor_config.json of config.json, or one of the following `model_type` keys in its config.json
config.json, I have both
vision-encoder-decoder as the model type, which is not included in the list given by the error.