RuntimeError: Error(s) in loading state_dict for SentimentClassifier: Missing key(s) in state_dict: "bert.embeddings.position_ids".
essentially i just git cloned the repository and ran "python3 bin/download_model". then i just ran the "uvicorn sentiment_analyzer.api:app". I, however, installed all the dependencies individually as i was having issues to using the "pipenv install --dev" command as it was return errors
this is the entire error message.
this is whats in my assets
and this is the config.json that i did not change
How am i missing the keys from state_dict? is there a preferred enviorment where i deploy this tutorial api?
Hey, I ran into same error today. But I could solve it. This SentimentClassifier was trained by transformers version 2.8.0, but Now if you install transformers without not designating version, you will get transformers==4.3.3. So if you want to execute this project, you should try following command.
pip install transformers==2.8.0
if you use mac os, maybe you will also encounter building error. You will solve it wit following command.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
after that, you will install transformers==2.8.0

Ran into the same error. The pipenv install --dev had locking issues. But since it can function without locking the dependencies, I moved on to pipenv shell and so on.
Not able to resolve the error in the image with either-
pip install transformers==2.8.0
or
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source $HOME/.cargo/env