Views
No views yet
Note: Initial release ships training + inference scaffolding.
Plug in your dataset and fine-tune, or point to an existing finance model.
1pip install -r requirements.txt
2
3Sentiment:
4
5from transformers import pipeline
6sentiment = pipeline(
7 "sentiment-analysis",
8 model="Proooof/Finance-NLP-Toolkit", # after you push your fine-tuned weights
9 tokenizer="Proooof/Finance-NLP-Toolkit"
10)
11print(sentiment("The company reported record profits and raised guidance."))
12
13NER:
14
15from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
16tok = AutoTokenizer.from_pretrained("YOUR-USERNAME/Finance-NLP-Toolkit", revision="ner")
17ner_model = AutoModelForTokenClassification.from_pretrained("YOUR-USERNAME/Finance-NLP-Toolkit", revision="ner")
18ner = pipeline("token-classification", model=ner_model, tokenizer=tok, aggregation_strategy="simple")
19print(ner("Apple Inc. reported a $10 billion revenue increase in Q2 2025."))
20
21Tip: Use branches to host multiple checkpoints in one repo:
22
23main → sentiment
24
25ner → NER model
26Push each set of weights to its respective branch.
27
28🧠 Training
29Sentiment (3-class)
30python training/train_sentiment.py \
31 --model_name distilbert-base-uncased \
32 --train_csv /path/train.csv \
33 --eval_csv /path/valid.csv \
34 --text_col text --label_col label \
35 --output_dir ./outputs/sentiment \
36 --epochs 3 --batch_size 16 --lr 5e-5
37
38NER (BIO tags)
39python training/train_ner.py \
40 --model_name bert-base-cased \
41 --train_json /path/train.jsonl \
42 --eval_json /path/valid.jsonl \
43 --text_col tokens --label_col ner_tags \
44 --labels_file training/labels_ner.json \
45 --output_dir ./outputs/ner \
46 --epochs 5 --batch_size 8 --lr 3e-5
47
48
49After training, push weights to the repo (e.g., git push origin main for sentiment and git push origin ner for NER).
50
51📊 Expected outputs
52
53Sentiment:
54
55[{'label': 'POSITIVE', 'score': 0.98}]
56
57
58NER:
59
60[
61 {'entity_group': 'ORG', 'word': 'Apple Inc.', 'score': 0.99},
62 {'entity_group': 'MONEY', 'word': '$10 billion', 'score': 0.99},
63 {'entity_group': 'DATE', 'word': 'Q2 2025', 'score': 0.98}
64]
65
66⚠️ Limitations
67
68English focus; domain shift may reduce accuracy
69
70Sarcasm/idioms can confound sentiment
71
72NER needs domain labels for best performance
73
74📜 License
75
76Apache-2.0