Can't find Keras.engine
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.colab.research.google.comGoogle ColaboratoryIt is in view mode.
2024-03-17T19:34:31Z
I suppose you should use TFAutomodelForSequentialClassification instead of AutomodelForSequentialClassification.
2024-03-29T00:03:47Z
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: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?