Leonard Püttmann
commited on
Commit
·
f94a3b0
1
Parent(s):
c428104
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Finetuned destilBERT model for stock news classification
|
2 |
+
|
3 |
+
This is a HuggingFace model that uses BERT (Bidirectional Encoder Representations from Transformers) to perform text classification tasks. It was fine-tuned on 50.000 stock news articles using the HuggingFace adapter from Kern AI refinery.
|
4 |
+
BERT is a state-of-the-art pre-trained language model that can encode both the left and right context of a word in a sentence, allowing it to capture complex semantic and syntactic information.
|
5 |
+
|
6 |
+
## Features
|
7 |
+
|
8 |
+
- The model can handle various text classification tasks, especially when it comes to stock and finance news sentiment classification.
|
9 |
+
- The model can accept either single sentences or sentence pairs as input, and output a probability distribution over the predefined classes.
|
10 |
+
- The model can be fine-tuned on custom datasets and labels using the HuggingFace Trainer API or the PyTorch Lightning integration.
|
11 |
+
- The model is currently supported by the PyTorch framework and can be easily deployed on various platforms using the HuggingFace Pipeline API or the ONNX Runtime.
|
12 |
+
|
13 |
+
## Usage
|
14 |
+
|
15 |
+
To use the model, you need to install the HuggingFace Transformers library:
|
16 |
+
|
17 |
+
```bash
|
18 |
+
pip install transformers
|
19 |
+
```
|
20 |
+
Then you can load the model and the tokenizer from the HuggingFace Hub:
|
21 |
+
|
22 |
+
```python
|
23 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
24 |
+
|
25 |
+
model = AutoModelForSequenceClassification.from_pretrained("KernAI/stock-news-destilbert")
|
26 |
+
tokenizer = AutoTokenizer.from_pretrained("KernAI/stock-news-destilbert")
|
27 |
+
```
|
28 |
+
To classify a single sentence or a sentence pair, you can use the HuggingFace Pipeline API:
|
29 |
+
|
30 |
+
```python
|
31 |
+
from transformers import pipeline
|
32 |
+
|
33 |
+
classifier = pipeline("text-classification", model=model, tokenizer=tokenizer)
|
34 |
+
result = classifier("This is a positive sentence.")
|
35 |
+
print(result)
|
36 |
+
# [{'label': 'POSITIVE', 'score': 0.9998656511306763}]
|
37 |
+
```
|