StephanAkkerman
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -32,6 +32,9 @@ widget:
|
|
32 |
example_title: Bullish Stock Tweet 2
|
33 |
- text: Italian companies braced for more political uncertainty
|
34 |
example_title: Bearish News
|
|
|
|
|
|
|
35 |
---
|
36 |
|
37 |
# FinTwitBERT-sentiment
|
@@ -53,34 +56,19 @@ For a comprehensive overview, including the training setup and analysis of the m
|
|
53 |
Using [HuggingFace's transformers library](https://huggingface.co/docs/transformers/index) the model and tokenizers can be converted into a pipeline for text classification.
|
54 |
|
55 |
```python
|
56 |
-
from transformers import
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
)
|
64 |
-
model.config.problem_type = "single_label_classification"
|
65 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
66 |
-
"StephanAkkerman/FinTwitBERT-sentiment"
|
67 |
-
)
|
68 |
-
model.eval()
|
69 |
-
pipeline = pipeline(
|
70 |
-
"text-classification", model=model, tokenizer=tokenizer
|
71 |
-
)
|
72 |
-
|
73 |
-
# Sentences we want the sentiment for
|
74 |
-
sentence = ["Nice 9% pre market move for $para, pump my calls Uncle Buffett 🤑"]
|
75 |
|
76 |
# Get the predicted sentiment
|
77 |
-
print(
|
78 |
```
|
79 |
|
80 |
-
## Training
|
81 |
-
|
82 |
-
The model was trained with the following parameters:
|
83 |
-
|
84 |
## Citing & Authors
|
85 |
|
86 |
If you use FinTwitBERT or FinTwitBERT-sentiment in your research, please cite us as follows, noting that both authors contributed equally to this work:
|
|
|
32 |
example_title: Bullish Stock Tweet 2
|
33 |
- text: Italian companies braced for more political uncertainty
|
34 |
example_title: Bearish News
|
35 |
+
#model-index:
|
36 |
+
#- name: FinTwitBERT-sentiment
|
37 |
+
# results:
|
38 |
---
|
39 |
|
40 |
# FinTwitBERT-sentiment
|
|
|
56 |
Using [HuggingFace's transformers library](https://huggingface.co/docs/transformers/index) the model and tokenizers can be converted into a pipeline for text classification.
|
57 |
|
58 |
```python
|
59 |
+
from transformers import pipeline
|
60 |
|
61 |
+
# Create a sentiment analysis pipeline
|
62 |
+
pipe = pipeline(
|
63 |
+
"sentiment-analysis",
|
64 |
+
model="StephanAkkerman/FinTwitBERT-sentiment",
|
65 |
+
tokenizer="StephanAkkerman/FinTwitBERT-sentiment",
|
66 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
# Get the predicted sentiment
|
69 |
+
print(pipe("Nice 9% pre market move for $para, pump my calls Uncle Buffett 🤑"))
|
70 |
```
|
71 |
|
|
|
|
|
|
|
|
|
72 |
## Citing & Authors
|
73 |
|
74 |
If you use FinTwitBERT or FinTwitBERT-sentiment in your research, please cite us as follows, noting that both authors contributed equally to this work:
|