# XLA Integration for TensorFlow Models

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fxla-integration-for-tensorflow-models%2F59075%3E%5C
**Category:** 🤗Transformers\
**Created:** [October 19, 2023, 4:35am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fxla-integration-for-tensorflow-models%2F59075 "2023-10-19T04:35:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![akote](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@akote](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fakote)%5C
**Post date:** [October 19, 2023, 4:35am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fxla-integration-for-tensorflow-models%2F59075%2F1 "2023-10-19T04:35:46Z")

</div>

Hi,  
I wanted to try XLA for Inference.  
`import os  
#environment configs

import tensorflow as tf

from transformers import BertTokenizer, TFBertModel  
tokenizer = BertTokenizer.from\_pretrained(‘bert-base-uncased’)  
model = TFBertModel.from\_pretrained(“bert-base-uncased”)  
xla\_generate = tf.function(model, jit\_compile=True)  
text = “Replace me by any text you’d like.”  
encoded\_input = tokenizer(text, return\_tensors=‘tf’)

from time import time  
start\_time = time()  
for i in range(1):  
output = xla\_generate(encoded\_input)  
end\_time = time()  
time\_taken = end\_time - start\_time  
print("average time (seconds) for bert Inference: ", time\_taken)`

For this code I am getting timing which more than without XLA and IF look into perf report of this I am not seeing any XLA OP and I am seeing oneDNN . So I wanted to understand how this XLA works with oneDNN

Thanks
