Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Error(s) in loading state_dict for SentimentClassifier: Missing key(s) in state_dict: "bert.embeddings.position_ids". #1

Open
Tony363 opened this issue Feb 11, 2021 · 2 comments

Comments

@Tony363
Copy link

Tony363 commented Feb 11, 2021

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

ksnip_20210211-204612
this is the entire error message.
ksnip_20210211-204850
this is whats in my assets
ksnip_20210211-204911
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?

@softmurata
Copy link

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

@SidtheKidx
Copy link

SidtheKidx commented Mar 28, 2021

image

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants