pierreguillou
commited on
Commit
•
4273bb3
1
Parent(s):
fdad9ab
Update README.md
Browse files
README.md
CHANGED
@@ -73,7 +73,7 @@ model_name = "ner-bert-base-portuguese-cased-lenebr"
|
|
73 |
model = AutoModelForTokenClassification.from_pretrained(model_name)
|
74 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
75 |
|
76 |
-
input_text = "
|
77 |
|
78 |
# tokenization
|
79 |
inputs = tokenizer(input_text, max_length=512, truncation=True, return_tensors="pt")
|
@@ -108,6 +108,35 @@ ner(input_text)
|
|
108 |
|
109 |
The notebook of finetuning ([HuggingFace_Notebook_token_classification_NER_LeNER_Br.ipynb](https://github.com/piegu/language-models/blob/master/HuggingFace_Notebook_token_classification_NER_LeNER_Br.ipynb)) is in github.
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
### Training results
|
112 |
|
113 |
````
|
|
|
73 |
model = AutoModelForTokenClassification.from_pretrained(model_name)
|
74 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
75 |
|
76 |
+
input_text = "Acrescento que não há de se falar em violação do artigo 114, § 3º, da Constituição Federal, posto que referido dispositivo revela-se impertinente, tratando da possibilidade de ajuizamento de dissídio coletivo pelo Ministério Público do Trabalho nos casos de greve em atividade essencial."
|
77 |
|
78 |
# tokenization
|
79 |
inputs = tokenizer(input_text, max_length=512, truncation=True, return_tensors="pt")
|
|
|
108 |
|
109 |
The notebook of finetuning ([HuggingFace_Notebook_token_classification_NER_LeNER_Br.ipynb](https://github.com/piegu/language-models/blob/master/HuggingFace_Notebook_token_classification_NER_LeNER_Br.ipynb)) is in github.
|
110 |
|
111 |
+
### Hyperparameters
|
112 |
+
|
113 |
+
#### batch, learning rate...
|
114 |
+
- per_device_batch_size = 4
|
115 |
+
- gradient_accumulation_steps = 2
|
116 |
+
- learning_rate = 2e-5
|
117 |
+
- num_train_epochs = 3
|
118 |
+
- weight_decay = 0.01
|
119 |
+
- optimizer = AdamW
|
120 |
+
- betas = (0.9,0.999)
|
121 |
+
- epsilon = 1e-08
|
122 |
+
- lr_scheduler_type = linear
|
123 |
+
- seed = 42
|
124 |
+
|
125 |
+
#### save model & load best model
|
126 |
+
- save_total_limit = 3
|
127 |
+
- logging_steps = 290
|
128 |
+
- eval_steps = logging_steps
|
129 |
+
- evaluation_strategy = 'steps'
|
130 |
+
- logging_strategy = 'steps'
|
131 |
+
- save_strategy = 'steps'
|
132 |
+
- save_steps = logging_steps
|
133 |
+
- load_best_model_at_end = True
|
134 |
+
- fp16 = True
|
135 |
+
|
136 |
+
#### get best model through a metric
|
137 |
+
- metric_for_best_model = 'eval_f1'
|
138 |
+
- greater_is_better = True
|
139 |
+
|
140 |
### Training results
|
141 |
|
142 |
````
|