# AttributeError: 'BERT\_Arch' object has no attribute 'Trainer'/predict

**URL:** <https://discuss.huggingface.co/t/attributeerror-bert-arch-object-has-no-attribute-trainer-predict/56043>\
**Category:** Beginners\
**Created:** [September 22, 2023, 7:41pm UTC](https://discuss.huggingface.co/t/attributeerror-bert-arch-object-has-no-attribute-trainer-predict/56043 "2023-09-22T19:41:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![reva123](https://avatars.discourse-cdn.com/v4/letter/r/5daacb/32.png) [@reva123](https://discuss.huggingface.co/u/reva123)\
**Post date:** [September 22, 2023, 7:41pm UTC](https://discuss.huggingface.co/t/attributeerror-bert-arch-object-has-no-attribute-trainer-predict/56043/1 "2023-09-22T19:41:36Z")

</div>

So I am making a voice assisstant for fast food restaurants and to train the dataset on a model I have used distilbert. After training and saving the model in pickle file, now I testing it on web app via Gradio.  
Here is the Gradio code  
‘’’

import gradio as gr  
import pickle  
def make\_prediction(text):  
with open(“model.pickle”, “rb”) as f:  
clf = pickle.load(f)  
preds = clf.Trainer.predict([text]) # Assuming your model accepts a single text input  
if preds == 1:  
return “Sure I will add your order, that will be $30, anything else?”  
elif preds == 2:  
return “I have added newer items in the list as well that will be $55.”  
elif preds == 3:  
return “That’s a great choice, you want in the veg or non-veg section?”  
elif preds == 4:  
return “Your order will be ready in 20 mins”  
elif preds == 5:  
return “Okay, I will make the quantity according to the specified number of people”

output = gr.Textbox()

app = gr.Interface(fn=make\_prediction, inputs=“text”, outputs=output)  
app.launch()  
‘’’  
After running this I get following error

raise AttributeError(“‘{}’ object has no attribute ‘{}’”.format(  
AttributeError: ‘BERT\_Arch’ object has no attribute 'Trainer

Please can someone tell how to fix this…I completely new in ML
