Does TrOCRDecoder.tflite include built-in token ID to string mapping?

#3
by KW1223 - opened

Does the TrOCRDecoder.tflite file include a built-in method for converting token IDs to strings, or do I need an additional mechanism to map token IDs to a dictionary?

Qualcomm org

Hi @KW1223 ,

You can take a look at our App class in the TrOCR folder: https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/trocr/app.py

This contains end-to-end python could that interacts with the model. In particular, please note that to decode the tokens we call self.io_processor.decode. The io_processor is an instance of TrOCRProcessor and defined in the Hugging Face package transformers. To understand exactly how it decodes the tokens, you can follow the trail into that repository.

Hope that helps,
Gustav

Sign up or log in to comment