# Can't find Keras.engine

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-find-keras-engine%2F77743%3E%5C
**Category:** 🤗Transformers\
**Created:** [March 17, 2024, 8:39am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-find-keras-engine%2F77743 "2024-03-17T08:39:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShubhamZoro](https://avatars.discourse-cdn.com/v4/letter/s/ad7895/32.png) [@ShubhamZoro](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FShubhamZoro)%5C
**Post date:** [March 17, 2024, 8:39am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-find-keras-engine%2F77743%2F1 "2024-03-17T08:39:17Z")

</div>

Hi,  
I am loading my Peft model from the hugging face hub and trying to do TRL. When I am trying to load a toxicity model and pass it through a pipeline. It shows an error.  
Here is my code,  
toxicity\_model\_name = “facebook/roberta-hate-speech-dynabench-r4-target”

toxicity\_tokenizer = AutoTokenizer.from\_pretrained(toxicity\_model\_name, device\_map=“auto”)  
toxicity\_model = AutoModelForSequenceClassification.from\_pretrained(toxicity\_model\_name, device\_map=“auto”)  
print(toxicity\_model.config.id2label)  
sentiment\_pipe = pipeline(“sentiment-analysis”,  
model=toxicity\_model\_name,  
device=device)  
error-  
Failed to import transformers.models.roberta.modeling\_tf\_roberta because of the following error (look up to see its traceback):  
No module named ‘keras.engine’  
I am using google colab to run the code.

> **[Google Colaboratory](https://colab.research.google.com/drive/1GbjaOoM1OEEtyXj75-ooboMe6rjdn2_H?usp=sharing)**

It is in view mode.

---

<div class="post-metadata">

**Author:** ![Sandy1857](https://avatars.discourse-cdn.com/v4/letter/s/ecae2f/32.png) [@Sandy1857](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FSandy1857)%5C
**Post date:** [March 17, 2024, 7:34pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-find-keras-engine%2F77743%2F2 "2024-03-17T19:34:31Z")

</div>

I suppose you should use TFAutomodelForSequentialClassification instead of AutomodelForSequentialClassification.

---

<div class="post-metadata">

**Author:** ![intotheverse](https://avatars.discourse-cdn.com/v4/letter/i/ad7895/32.png) [@intotheverse](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fintotheverse)%5C
**Post date:** [March 29, 2024, 12:03am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fcant-find-keras-engine%2F77743%2F3 "2024-03-29T00:03:47Z")

</div>

Guys but the “facebook/roberta-hate-speech-dynabench-r4-target” is a Pytorch model, isn’t it?

I get to make it work with pytorch specifying the framework like this:

```auto

sentiment_pipe = pipeline("sentiment-analysis", 
                          model=toxicity_model_name, #toxicity_model,tokenizer=toxicity_tokenizer,
                          framework="pt",
                          device=device)

```

But latter I get the same error from the evaluator. Any ideas?
