Financial Sentiment Analysis in Chinese
This is a fine-tuned version of FinBERT, based on bert-base-chinese, on a private dataset (around ~8k analyst report sentences) for sentiment analysis.
- Test Accuracy = 0.88
- Test Macro F1 = 0.87
- Labels: 0 -> Neutral; 1 -> Positive; 2 -> Negative
Usage
from transformers import TextClassificationPipeline
from transformers import AutoModelForSequenceClassification, TrainingArguments, Trainer
from transformers import BertTokenizerFast
model_path="./fin_sentiment_bert_zh/"
new_model = AutoModelForSequenceClassification.from_pretrained(model_path,output_attentions=True)
tokenizer = BertTokenizerFast.from_pretrained(model_path)
PipelineInterface = TextClassificationPipeline(model=new_model, tokenizer=tokenizer, return_all_scores=True)
label = PipelineInterface("此外宁德时代上半年实现出口约2GWh,同比增加200%+。")
print(label)
[[{'label': 'LABEL_0', 'score': 0.0007030126871541142}, {'label': 'LABEL_1', 'score': 0.9989339709281921}, {'label': 'LABEL_2', 'score': 0.000363016442861408}]]
- Downloads last month
- 1,169
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social
visibility and check back later, or deploy to Inference Endpoints (dedicated)
instead.