Expand model card: auto-download note, batching, score definition, provenance
Browse files
README.md
CHANGED
|
@@ -23,6 +23,11 @@ register: irony, slang, emoji, and self-deprecation. On the held-out set below,
|
|
| 23 |
vanilla FinBERT scores **below the majority-class floor**, i.e. worse than ignoring
|
| 24 |
the text entirely. This model is a domain-adaptation check on that gap.
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
## Labels
|
| 27 |
|
| 28 |
| id | label |
|
|
@@ -33,6 +38,14 @@ the text entirely. This model is a domain-adaptation check on that gap.
|
|
| 33 |
|
| 34 |
## Usage
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
```python
|
| 37 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 38 |
import torch
|
|
@@ -49,7 +62,20 @@ with torch.no_grad():
|
|
| 49 |
print({model.config.id2label[i]: round(p.item(), 3) for i, p in enumerate(probs)})
|
| 50 |
```
|
| 51 |
|
| 52 |
-
A continuous sentiment score in [-1, 1]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
## Training data
|
| 55 |
|
|
|
|
| 23 |
vanilla FinBERT scores **below the majority-class floor**, i.e. worse than ignoring
|
| 24 |
the text entirely. This model is a domain-adaptation check on that gap.
|
| 25 |
|
| 26 |
+
This is the frozen checkpoint behind the results reported in *Beyond the Volume of Attention:
|
| 27 |
+
Domain-Adapted Sentiment and the Content of Retail Investor Discussion* (ICAIF '26) — not a
|
| 28 |
+
retrained copy. The replication package for that paper is distributed separately; this
|
| 29 |
+
repository is the model only.
|
| 30 |
+
|
| 31 |
## Labels
|
| 32 |
|
| 33 |
| id | label |
|
|
|
|
| 38 |
|
| 39 |
## Usage
|
| 40 |
|
| 41 |
+
You do not need to download anything by hand. `transformers` fetches the weights on first use
|
| 42 |
+
and caches them under `~/.cache/huggingface/`, so the first call takes a moment (~440 MB) and
|
| 43 |
+
every call after that is instant.
|
| 44 |
+
|
| 45 |
+
```
|
| 46 |
+
pip install transformers torch
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
```python
|
| 50 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 51 |
import torch
|
|
|
|
| 62 |
print({model.config.id2label[i]: round(p.item(), 3) for i, p in enumerate(probs)})
|
| 63 |
```
|
| 64 |
|
| 65 |
+
A continuous sentiment score in [-1, 1] is formed as `P(positive) - P(negative)`. This is the
|
| 66 |
+
`sentiment_wsb` variable used throughout the paper — the sign gives the direction and the
|
| 67 |
+
magnitude gives the confidence. **Use `max_length=128`**: that is what the model was trained
|
| 68 |
+
with, and longer inputs are truncated to it.
|
| 69 |
+
|
| 70 |
+
For many texts at once, batch them rather than looping:
|
| 71 |
+
|
| 72 |
+
```python
|
| 73 |
+
texts = ["...", "...", "..."]
|
| 74 |
+
batch = tok(texts, return_tensors="pt", truncation=True, max_length=128, padding=True)
|
| 75 |
+
with torch.no_grad():
|
| 76 |
+
p = model(**batch).logits.softmax(-1)
|
| 77 |
+
scores = (p[:, 2] - p[:, 0]).tolist()
|
| 78 |
+
```
|
| 79 |
|
| 80 |
## Training data
|
| 81 |
|