Views
No views yet
FinancialReports/filing-classification-xlmr (Assumed Repo ID based on AutoTrain project & org)FacebookAI/xlm-roberta-large designed for multi-class text classification of financial filing documents. It classifies input text (expected in markdown format) into one of 37 predefined filing type categories.FacebookAI/xlm-roberta-largetransformers library:1from transformers import pipeline
2
3# Load the classifier pipeline (replace with your actual model repo ID on the Hub)
4model_repo_id = "FinancialReports/filing-classification-xlmr"
5classifier = pipeline("text-classification", model=model_repo_id)
6
7# Example usage
8filing_text = """
9## ACME Corp Q4 Results
10
11ACME Corporation today announced financial results for its fourth quarter ended December 31...
12(Insert markdown filing text here)
13"""
14
15# Get top predictions with scores (confidence)
16predictions = classifier(filing_text, top_k=5)
17print(predictions)
18# Expected output format:
19# [{'label': 'Quarterly Report', 'score': 0.98}, {'label': 'Earnings Release', 'score': 0.01}, ...]
20
21# --- To get probabilities for all classes ---
22# from transformers import AutoTokenizer, AutoModelForSequenceClassification
23# import torch
24#
25# tokenizer = AutoTokenizer.from_pretrained(model_repo_id)
26# model = AutoModelForSequenceClassification.from_pretrained(model_repo_id)
27# inputs = tokenizer(filing_text, return_tensors="pt", truncation=True, padding=True, max_length=512)
28# with torch.no_grad():
29# logits = model(**inputs).logits
30# probabilities = torch.softmax(logits, dim=-1)[0] # Get probabilities for first item
31# results = [{"label": model.config.id2label[i], "score": prob.item()} for i, prob in enumerate(probabilities)]
32# results.sort(key=lambda x: x["score"], reverse=True)
33# print(results)
34Citation@misc{financialreports_filing_classifier_2025,
35 author = {FinancialReports},
36 title = {XLM-RoBERTa-Large Financial Filing Classifier},
37 year = {2025},
38 publisher = {Hugging Face},
39 journal = {Hugging Face Model Hub},
40 howpublished = {\url{[https://huggingface.co/FinancialReports/filing-classification-xlmr](https://www.google.com/search?q=https://huggingface.co/FinancialReports/filing-classification-xlmr)}}, # Assumed URL
41}