lucas-leme commited on
Commit
7cd9087
1 Parent(s): 4865d7c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +18 -1
README.md CHANGED
@@ -31,7 +31,7 @@ Among the applications, it was demonstrated that the model can be used to build
31
 
32
  ## Usage
33
 
34
- In order to use the model, you need to get the HuggingFace auth token. You can get it [here](https://huggingface.co/settings/token).
35
 
36
  ```python
37
  from transformers import AutoTokenizer, BertForSequenceClassification
@@ -52,6 +52,23 @@ finbertptbr_outputs = finbertptbr(**tokens)
52
 
53
  preds = [pred_mapper[np.argmax(pred)] for pred in finbertptbr_outputs.logits.cpu().detach().numpy()]
54
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  ## Author
56
 
57
  - [Lucas Leme](https://www.linkedin.com/in/lucas-leme-santos/) - [email protected]
 
31
 
32
  ## Usage
33
 
34
+ #### BertForSequenceClassification
35
 
36
  ```python
37
  from transformers import AutoTokenizer, BertForSequenceClassification
 
52
 
53
  preds = [pred_mapper[np.argmax(pred)] for pred in finbertptbr_outputs.logits.cpu().detach().numpy()]
54
  ```
55
+
56
+ #### Pipeline
57
+
58
+ ```python
59
+ from transformers import (
60
+ AutoTokenizer,
61
+ BertForSequenceClassification,
62
+ pipeline,
63
+ )
64
+
65
+ finbert_pt_br_tokenizer = AutoTokenizer.from_pretrained("lucas-leme/FinBERT-PT-BR")
66
+ finbert_pt_br_model = BertForSequenceClassification.from_pretrained("lucas-leme/FinBERT-PT-BR")
67
+
68
+ finbert_pt_br_pipeline = pipeline(task='text-classification', model=finbert_pt_br_model, tokenizer=finbert_pt_br_tokenizer)
69
+ finbert_pt_br_pipeline(['Hoje a bolsa caiu', 'Hoje a bolsa subiu'])
70
+ ```
71
+
72
  ## Author
73
 
74
  - [Lucas Leme](https://www.linkedin.com/in/lucas-leme-santos/) - [email protected]