Downloads · 30 days
10
21% of all-time downloads
radmada/FinBERT-BaseVocab-Cased
FinBERT-BaseVocab-Cased is a fill-mask model from radmada. Use it when you need the model to fill a missing word. It is set up for transformers.
Downloads · 30 days
10
21% of all-time downloads
All-time downloads
47
Public
Repo size
872 MB
Likes
0
Public
Click a slice to open those files.
.bin436 MB · 100%
From the Hugging Face model README
from transformers import BertTokenizer, BertForSequenceClassification
import numpy as np
finbert = BertForSequenceClassification.from_pretrained('yiyanghkust/finbert-tone',num_labels=3)
tokenizer = BertTokenizer.from_pretrained('yiyanghkust/finbert-tone')
sentences = ["there is a shortage of capital, and we need extra financing",
"growth is strong and we have plenty of liquidity",
"there are doubts about our finances",
"profits are flat"]
inputs = tokenizer(sentences, return_tensors="pt", padding=True)
outputs = finbert(**inputs)[0]
labels = {0:'neutral', 1:'positive',2:'negative'}
for idx, sent in enumerate(sentences):
print(sent, '----', labels[np.argmax(outputs.detach().numpy()[idx])])
'''
there is a shortage of capital, and we need extra financing ---- negative
growth is strong and we have plenty of liquidity ---- positive
there are doubts about our finances ---- negative
profits are flat ---- neutral
'''
@misc{yang2020finbert,
title={FinBERT: A Pretrained Language Model for Financial Communications},
author={Yi Yang and Mark Christopher Siy UY and Allen Huang},
year={2020},
eprint={2006.08097},
archivePrefix={arXiv},
}