Downloads · 30 days
11
29% of all-time downloads
Tasfiya025/FinBERT-Multilingual-Intent-and-Sentiment
FinBERT-Multilingual-Intent-and-Sentiment is a machine learning model from Tasfiya025. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
FinBERT-Multilingual-Intent-and-Sentiment is a BERT-based model fine-tuned for joint multi-label classification on financial customer service messages. It is designed to simultaneously classify the Intent (e.g., 'Acco…
Downloads · 30 days
11
29% of all-time downloads
All-time downloads
38
Public
Repo size
—
Likes
0
Public
Click a slice to open those files.
.md3.8 KB · 50%
From the Hugging Face model README
FinBERT-Multilingual-Intent-and-Sentiment is a BERT-based model fine-tuned for joint multi-label classification on financial customer service messages. It is designed to simultaneously classify the Intent (e.g., 'Account_Access_Issue', 'Mortgage_Inquiry') and the Sentiment/Urgency (e.g., 'Negative', 'Anxious', 'Positive') of a message. The model is trained on a multilingual corpus, supporting English (en), Spanish (es), French (fr), German (de), and Portuguese (pt).
The model leverages the robustness of a multilingual BERT base and adapts it specifically for the high-stakes financial domain, making it ideal for automating customer service routing and prioritization.
The model is built upon the bert-base-multilingual-cased backbone.
BertForSequenceClassification)from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model_name = "Finance/FinBERT-Multilingual-Intent-and-Sentiment"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
# Example 1: Spanish Complaint
text_es = "El virement que hice no ha llegado. Es un servicio terrible."
# Example 2: English Inquiry
text_en = "I need to increase my credit card limit before I travel next week."
# Process both texts
inputs = tokenizer([text_es, text_en], return_tensors="pt", padding=True, truncation=True)
outputs = model(**inputs)
# Get predictions
logits = outputs.logits
probabilities = torch.sigmoid(logits)
# Apply threshold (e.g., 0.5) to get multi-label predictions
threshold = 0.5
predictions = (probabilities > threshold).int()
# Map predictions back to labels
labels = model.config.id2label
predicted_labels = []
for p in predictions:
active_labels = [labels[i] for i, val in enumerate(p) if val == 1]
predicted_labels.append(active_labels)
print(f"Spanish Message Labels: {predicted_labels[0]}")
# Expected output: ['intent: Transfer_Delay_Complaint', 'sentiment: Negative']
print(f"English Message Labels: {predicted_labels[1]}")
# Expected output: ['intent: Credit_Limit_Increase_Request', 'sentiment: Neutral']