codealchemist01 commited on
Commit
52ad621
·
verified ·
1 Parent(s): a757d85

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ license: apache-2.0
4
+ tags:
5
+ - financial-sentiment
6
+ - sentiment-analysis
7
+ - finance
8
+ - nlp
9
+ - transformers
10
+ datasets:
11
+ - zeroshot/twitter-financial-news-sentiment
12
+ metrics:
13
+ - accuracy
14
+ - f1
15
+ model-index:
16
+ - name: financial-sentiment-distilbert
17
+ results:
18
+ - task:
19
+ type: text-classification
20
+ name: Financial Sentiment Analysis
21
+ dataset:
22
+ name: Twitter Financial News Sentiment
23
+ type: zeroshot/twitter-financial-news-sentiment
24
+ metrics:
25
+ - type: accuracy
26
+ value: 0.797
27
+ name: Accuracy
28
+ ---
29
+
30
+ # financial-sentiment-distilbert
31
+
32
+ ## Model Description
33
+
34
+ DistilBERT-based financial sentiment analysis model trained on balanced dataset
35
+
36
+ This model is fine-tuned from `distilbert-base-uncased` for financial sentiment analysis, capable of classifying financial text into three categories:
37
+ - **Bearish** (0): Negative financial sentiment
38
+ - **Neutral** (1): Neutral financial sentiment
39
+ - **Bullish** (2): Positive financial sentiment
40
+
41
+ ## Model Performance
42
+
43
+ - **Accuracy**: 0.797
44
+ - **Dataset**: Twitter Financial News Sentiment
45
+ - **Base Model**: distilbert-base-uncased
46
+
47
+ ## Usage
48
+
49
+ ```python
50
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
51
+ import torch
52
+
53
+ # Load model and tokenizer
54
+ tokenizer = AutoTokenizer.from_pretrained("codealchemist01/financial-sentiment-distilbert")
55
+ model = AutoModelForSequenceClassification.from_pretrained("codealchemist01/financial-sentiment-distilbert")
56
+
57
+ # Example usage
58
+ text = "Apple stock is showing strong growth potential"
59
+ inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
60
+
61
+ with torch.no_grad():
62
+ outputs = model(**inputs)
63
+ predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
64
+ predicted_class = torch.argmax(predictions, dim=-1).item()
65
+
66
+ # Labels: 0=Bearish, 1=Neutral, 2=Bullish
67
+ labels = ["Bearish", "Neutral", "Bullish"]
68
+ print(f"Prediction: {labels[predicted_class]}")
69
+ ```
70
+
71
+ ## Training Details
72
+
73
+ - **Training Dataset**: Twitter Financial News Sentiment
74
+ - **Training Framework**: Transformers
75
+ - **Optimization**: AdamW
76
+ - **Hardware**: RTX GPU
77
+
78
+ ## Limitations
79
+
80
+ This model is specifically trained for financial sentiment analysis and may not perform well on general sentiment analysis tasks.
81
+
82
+ ## Citation
83
+
84
+ If you use this model, please cite:
85
+
86
+ ```bibtex
87
+ @misc{financial-sentiment-distilbert,
88
+ author = {CodeAlchemist01},
89
+ title = {financial-sentiment-distilbert},
90
+ year = {2024},
91
+ publisher = {Hugging Face},
92
+ url = {https://huggingface.co/codealchemist01/financial-sentiment-distilbert}
93
+ }
94
+ ```
config.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation": "gelu",
3
+ "architectures": [
4
+ "DistilBertForSequenceClassification"
5
+ ],
6
+ "attention_dropout": 0.1,
7
+ "dim": 768,
8
+ "dropout": 0.1,
9
+ "dtype": "float32",
10
+ "hidden_dim": 3072,
11
+ "id2label": {
12
+ "0": "Bearish",
13
+ "1": "Neutral",
14
+ "2": "Bullish"
15
+ },
16
+ "initializer_range": 0.02,
17
+ "label2id": {
18
+ "Bearish": 0,
19
+ "Bullish": 2,
20
+ "Neutral": 1
21
+ },
22
+ "max_position_embeddings": 512,
23
+ "model_type": "distilbert",
24
+ "n_heads": 12,
25
+ "n_layers": 6,
26
+ "pad_token_id": 0,
27
+ "problem_type": "single_label_classification",
28
+ "qa_dropout": 0.1,
29
+ "seq_classif_dropout": 0.2,
30
+ "sinusoidal_pos_embds": false,
31
+ "tie_weights_": true,
32
+ "transformers_version": "4.57.0",
33
+ "vocab_size": 30522
34
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:95f41ba40156784461df3231f48e24639fa85aac5adf33547e75eaa74a303370
3
+ size 267835644
special_tokens_map.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": "[CLS]",
3
+ "mask_token": "[MASK]",
4
+ "pad_token": "[PAD]",
5
+ "sep_token": "[SEP]",
6
+ "unk_token": "[UNK]"
7
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "[PAD]",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "100": {
12
+ "content": "[UNK]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "101": {
20
+ "content": "[CLS]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "102": {
28
+ "content": "[SEP]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "103": {
36
+ "content": "[MASK]",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "clean_up_tokenization_spaces": false,
45
+ "cls_token": "[CLS]",
46
+ "do_lower_case": true,
47
+ "extra_special_tokens": {},
48
+ "mask_token": "[MASK]",
49
+ "model_max_length": 512,
50
+ "pad_token": "[PAD]",
51
+ "sep_token": "[SEP]",
52
+ "strip_accents": null,
53
+ "tokenize_chinese_chars": true,
54
+ "tokenizer_class": "DistilBertTokenizer",
55
+ "unk_token": "[UNK]"
56
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff