StephanAkkerman commited on
Commit
47d5578
1 Parent(s): 19e685d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +10 -22
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 BertForSequenceClassification, AutoTokenizer, pipeline
57
 
58
- model = BertForSequenceClassification.from_pretrained(
59
- "StephanAkkerman/FinTwitBERT-sentiment",
60
- num_labels=3,
61
- id2label={0: "NEUTRAL", 1: "BULLISH", 2: "BEARISH"},
62
- label2id={"NEUTRAL": 0, "BULLISH": 1, "BEARISH": 2},
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(pipeline(sentence))
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: