PyData Global 2022

Georgios Balikas

Georgios Balikas is a Lead Data Scientist at Salesforce Search. He works on building production models for machine learning applications such as named entity recognition, classification, ranking and question answering. He holds a PhD from the University of Grenoble Alps on the intersection of machine learning and natural language processing.

The speaker's profile picture

Sessions

12-02
13:00
30min
Converting sentence-transformers models to a single tensorflow graph
Georgios Balikas

Getting predictions from transformer models such as BERT requires two steps: first to query the tokenizer and then feed the outputs to the deep learning model itself. These two parts of the model are kept under different class implementations in popular open source implementations like Huggingface Transformers and Sentence-Transformers. This works well within Python but when one wants to put such a model in production or convert it to more efficient formats like onnx that may be served by other languages such as JVM-based it is preferable and simpler (and less risky) to have a single artifact that is directly queried. This talk builds on the popular sentence-transformers library and shows how one can transform a sentence-transformer model into a single tensorflow artifact that can be queried with strings and is ready for serving. At the end of the talk the audience will get a better understanding of the architecture of sentence-transformers and the required steps for converting a sentence-transformer model to a single tensorflow graph. The code is released as a set of notebooks so that the audience can replicate the results.

Talk Track I