# Trainer.\_\_init\_\_() got an unexpected keyword argument 'model'

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftrainer-init-got-an-unexpected-keyword-argument-model%2F41262%3E%5C
**Category:** 🤗Transformers\
**Created:** [May 29, 2023, 3:59am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftrainer-init-got-an-unexpected-keyword-argument-model%2F41262 "2023-05-29T03:59:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![minhleduc](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/minhleduc/32/57979_2.png) [@minhleduc](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fminhleduc)%5C
**Post date:** [May 29, 2023, 3:59am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftrainer-init-got-an-unexpected-keyword-argument-model%2F41262%2F1 "2023-05-29T03:59:35Z")

</div>

I followed these [instructions for fine-tuning model](https://huggingface.co/docs/transformers/training#prepare-a-dataset), and everything works nicely since I got these problems. I am using Google Colab for fine-tuning.

![image](https://us1.discourse-cdn.com/hellohellohello/original/3X/d/c/dc1c1e454d84764bbcdda7fe17846e0b822b91d0.png)

It’s strange since the Trainer can not recognize the model. I have already tried using BertForSequenceClassification and AutoModelForSequenceClassification but the results are the same.

 ![image](https://us1.discourse-cdn.com/hellohellohello/original/3X/6/c/6cf0b72d1c5e923210725b4bc22e8fbf5296abf0.png)

Is there any way to fix this?  
By the way, I install libraries following the above link.

---

<div class="post-metadata">

**Author:** ![minhleduc](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/minhleduc/32/57979_2.png) [@minhleduc](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fminhleduc)%5C
**Post date:** [May 29, 2023, 7:04am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftrainer-init-got-an-unexpected-keyword-argument-model%2F41262%2F2 "2023-05-29T07:04:36Z")

</div>

The problem is solved. Indeed, I used Pytorch Lightning and HuggingFace in parallel. It may be some conflicts between Trainer of hugging-face and pytorch\_lightning. After I’ve removed libraries related to pytorch\_lightning, the code runs smoothly.
