boblef / twitter_sentiment

A Flask application of Twitter sentiment analysis by using FinBERT, which is a pre-trained NLP model trained on the financial corpus.
3 stars 1 forks source link

ran into this issue while running the app #13

Closed kyoungd closed 3 years ago

kyoungd commented 3 years ago

(base) young@young-1:~/Desktop/code/trading/twitter_sentiment$ python3 app.py [nltk_data] Downloading package punkt to /home/young/nltk_data... [nltk_data] Package punkt is already up-to-date! 05/14/2021 09:18:33 - INFO - pytorch_pretrained_bert.modeling - loading archive file model/sentiment/finbert 05/14/2021 09:18:33 - INFO - pytorch_pretrained_bert.modeling - Model config { "attention_probs_dropout_prob": 0.1, "hidden_act": "gelu", "hidden_dropout_prob": 0.1, "hidden_size": 768, "initializer_range": 0.02, "intermediate_size": 3072, "max_position_embeddings": 512, "num_attention_heads": 12, "num_hidden_layers": 12, "type_vocab_size": 2, "vocab_size": 30522 }

Traceback (most recent call last): File "app.py", line 36, in model = BertForSequenceClassification.from_pretrained( File "/home/young/.local/lib/python3.8/site-packages/pytorch_pretrained_bert/modeling.py", line 603, in from_pretrained state_dict = torch.load(weights_path, map_location='cpu') File "/home/young/anaconda3/lib/python3.8/site-packages/torch/serialization.py", line 595, in load return _legacy_load(opened_file, map_location, pickle_module, pickle_load_args) File "/home/young/anaconda3/lib/python3.8/site-packages/torch/serialization.py", line 764, in _legacy_load magic_number = pickle_module.load(f, pickle_load_args) _pickle.UnpicklingError: invalid load key, 'v'.

kyoungd commented 3 years ago

My mistake. I did not install the "git lfs" on my machine.