File size: 4,380 Bytes
c1ad50a
 
 
9e10915
c1ad50a
 
6bfb409
 
 
 
 
c1ad50a
 
 
83810c8
 
 
c1ad50a
 
 
 
 
9d5fc29
 
9e10915
9d5fc29
 
b85621c
c1ad50a
7430ace
6bfb409
6fca7f5
 
 
 
 
 
 
 
 
c1ad50a
 
 
b971582
b85621c
 
 
 
 
b971582
c1ad50a
 
 
 
b971582
c1ad50a
 
 
 
 
 
 
7430ace
c1ad50a
 
 
 
00240d1
c1ad50a
6bfb409
 
 
 
7430ace
 
 
 
 
6bfb409
 
59ea2cc
 
 
 
f9b4a20
 
 
 
 
 
59ea2cc
 
 
4bb372c
 
 
b97a805
59ea2cc
 
 
 
 
 
c1ad50a
 
 
 
 
 
0cdfb3d
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
---
license: mit
base_model: microsoft/deberta-v3-small
thumbnail: https://huggingface.co/mrm8488/deberta-v3-ft-financial-news-sentiment-analysis/resolve/main/logo_ft_2.png?download=true
tags:
- generated_from_trainer
metrics:
- precision
- recall
- accuracy
- f1
model-index:
- name: deberta-v3-ft-news-sentiment-analisys
  results: []

widget:
  - text: Operating profit totaled EUR 9.4 mn , down from EUR 11.7 mn in 2004 .
---

<!-- This model card has been generated automatically according to the information the Trainer had access to. You
should probably proofread and complete it, then remove this comment. -->


<div style="text-align:center;width:250px;height:250px;">
    <img src="https://huggingface.co/mrm8488/deberta-v3-ft-financial-news-sentiment-analysis/resolve/main/logo_ft_2.png" alt="logo">
</div>

# DeBERTa-v3-small-ft-news-sentiment-analisys

This model is a fine-tuned version of [microsoft/deberta-v3-small](https://huggingface.co/microsoft/deberta-v3-small) on the None dataset.
It achieves the following results on the evaluation set:

| Metric    | Value    |
|-----------|----------|
| F1        | 0.**99**40   |
| Accuracy  | 0.**99**40   |
| Precision | 0.9940   |
| Recall    | 0.9940   |
| Loss      | 0.0233   |


## Model description

[DeBERTa](https://arxiv.org/abs/2006.03654) improves the BERT and RoBERTa models using disentangled attention and enhanced mask decoder. With those two improvements, DeBERTa performs RoBERTa on a majority of NLU tasks with 80GB of training data. 

In [DeBERTa V3](https://arxiv.org/abs/2111.09543), we further improved the efficiency of DeBERTa using ELECTRA-Style pre-training with Gradient Disentangled Embedding Sharing. Compared to DeBERTa,  our V3 version significantly improves the model performance on downstream tasks.  You can find more technique details about the new model from our [paper](https://arxiv.org/abs/2111.09543).

Please check the [official repository](https://github.com/microsoft/DeBERTa) for more implementation details and updates.

The DeBERTa V3 small model comes with six layers and a hidden size of 768. It has **44M** backbone parameters  with a vocabulary containing 128K tokens which introduces 98M parameters in the Embedding layer.  This model was trained using the 160GB data as DeBERTa V2.


## Training and evaluation data

Polar sentiment dataset of sentences from financial news. The dataset consists of 4840 sentences from English-language financial news categorized by sentiment. The dataset is divided by an agreement rate of 5-8 annotators.

## Training procedure

### Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 2e-05
- train_batch_size: 64
- eval_batch_size: 64
- seed: 42
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- num_epochs: 5

### Training results

| Training Loss | Epoch | Step | Validation Loss | Precision | Recall | Accuracy | F1     |
|:-------------:|:-----:|:----:|:---------------:|:---------:|:------:|:--------:|:------:|
| No log        | 1.0   | 214  | 0.1865          | 0.9323    | 0.9323 | 0.9323   | 0.9323 |
| No log        | 2.0   | 428  | 0.0742          | 0.9771    | 0.9771 | 0.9771   | 0.9771 |
| 0.2737        | 3.0   | 642  | 0.0479          | 0.9855    | 0.9855 | 0.9855   | 0.9855 |
| 0.2737        | 4.0   | 856  | 0.0284          | 0.9923    | 0.9923 | 0.9923   | 0.9923 |
| 0.0586        | 5.0   | 1070 | 0.0233          | 0.9940    | 0.9940 | 0.9940   | 0.9940 |




## Example of usage


In case you did not installed it:
```sh
pip install transformers sentencepiece
```

```py
from transformers import pipeline

task = "text-classification"
model_id = "mrm8488/deberta-v3-ft-financial-news-sentiment-analysis"

classifier = pipeline(task, model_id)
text = "Tesla cars are not as good as expected"
result = classifier(text)
print(result)
```


### Framework versions

- Transformers 4.35.2
- Pytorch 2.1.0+cu121
- Datasets 2.16.1
- Tokenizers 0.15.0

## Citation

```BibText
@misc {manuel_romero_2024,
	author       = { {Manuel Romero} },
	title        = { deberta-v3-ft-financial-news-sentiment-analysis (Revision 7430ace) },
	year         = 2024,
	url          = { https://huggingface.co/mrm8488/deberta-v3-ft-financial-news-sentiment-analysis },
	doi          = { 10.57967/hf/1666 },
	publisher    = { Hugging Face }
}
```