Training 20251202_133947 - 7 classes
#12
by rkenji - opened
- README.md +5 -104
- config.json +13 -12
- model.safetensors +0 -3
- special_tokens_map.json +35 -5
README.md
CHANGED
|
@@ -1,33 +1,6 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
language: pt
|
| 5 |
-
license: apache-2.0
|
| 6 |
-
tags:
|
| 7 |
-
- text-classification
|
| 8 |
-
- legal
|
| 9 |
-
- bert
|
| 10 |
-
- portuguese
|
| 11 |
-
- brazilian-legal-documents
|
| 12 |
-
model-index:
|
| 13 |
-
- name: testmodel
|
| 14 |
-
results:
|
| 15 |
-
- task:
|
| 16 |
-
type: text-classification
|
| 17 |
-
dataset:
|
| 18 |
-
name: Legal Documents Classification Dataset
|
| 19 |
-
type: legal_documents
|
| 20 |
-
metrics:
|
| 21 |
-
- type: accuracy
|
| 22 |
-
value: 0.936231884057971
|
| 23 |
-
- type: f1
|
| 24 |
-
value: 0.9353615414017292
|
| 25 |
-
- type: precision
|
| 26 |
-
value: 0.9369069235885541
|
| 27 |
-
- type: recall
|
| 28 |
-
value: 0.936231884057971
|
| 29 |
-
- type: f1_macro
|
| 30 |
-
value: 0.8474441104841182
|
| 31 |
---
|
| 32 |
|
| 33 |
# Model Card for Model ID
|
|
@@ -42,86 +15,14 @@ model-index:
|
|
| 42 |
|
| 43 |
<!-- Provide a longer summary of what this model is. -->
|
| 44 |
|
| 45 |
-
|
| 46 |
-
# Modelo de Classificação de Documentos Jurídicos
|
| 47 |
-
|
| 48 |
-
Este modelo foi treinado para classificar documentos jurídicos brasileiros usando BERT multilíngue.
|
| 49 |
-
|
| 50 |
-
## Detalhes do Modelo
|
| 51 |
-
|
| 52 |
-
- **Base Model:** google-bert/bert-base-multilingual-cased
|
| 53 |
-
- **Tipo:** Classificação Multiclasse
|
| 54 |
-
- **Número de Classes:** 6
|
| 55 |
-
- **Idioma:** Português (Brasil)
|
| 56 |
-
- **Domínio:** Documentos Jurídicos
|
| 57 |
-
|
| 58 |
-
## Classes
|
| 59 |
-
|
| 60 |
-
0. Alvará
|
| 61 |
-
1. Sentença
|
| 62 |
-
2. Penhora
|
| 63 |
-
3. Citação
|
| 64 |
-
4. Art. 40
|
| 65 |
-
5. Não Influencia
|
| 66 |
-
|
| 67 |
-
## Métricas de Avaliação
|
| 68 |
-
|
| 69 |
-
As métricas abaixo foram calculadas no conjunto de validação:
|
| 70 |
-
|
| 71 |
-
- **Accuracy:** 0.9362
|
| 72 |
-
- **F1-Score (Weighted):** 0.9354
|
| 73 |
-
- **Precision (Weighted):** 0.9369
|
| 74 |
-
- **Recall (Weighted):** 0.9362
|
| 75 |
-
- **F1-Score (Macro):** 0.8474
|
| 76 |
-
|
| 77 |
-
## Classification Report Completo
|
| 78 |
-
|
| 79 |
-
```
|
| 80 |
-
precision recall f1-score support
|
| 81 |
-
|
| 82 |
-
0 0.60 0.38 0.46 8
|
| 83 |
-
1 0.86 0.98 0.92 45
|
| 84 |
-
2 1.00 0.85 0.92 54
|
| 85 |
-
3 0.85 0.95 0.90 41
|
| 86 |
-
4 0.93 0.95 0.94 121
|
| 87 |
-
5 0.95 0.95 0.95 421
|
| 88 |
-
|
| 89 |
-
accuracy 0.94 690
|
| 90 |
-
macro avg 0.87 0.84 0.85 690
|
| 91 |
-
weighted avg 0.94 0.94 0.94 690
|
| 92 |
-
|
| 93 |
-
```
|
| 94 |
-
|
| 95 |
-
## Uso
|
| 96 |
-
|
| 97 |
-
```python
|
| 98 |
-
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 99 |
-
import torch
|
| 100 |
-
|
| 101 |
-
# Carregar modelo e tokenizer
|
| 102 |
-
model = AutoModelForSequenceClassification.from_pretrained("rkenji/testmodel")
|
| 103 |
-
tokenizer = AutoTokenizer.from_pretrained("rkenji/testmodel")
|
| 104 |
-
|
| 105 |
-
# Fazer predição
|
| 106 |
-
texto = "Seu texto jurídico aqui"
|
| 107 |
-
inputs = tokenizer(texto, return_tensors="pt", truncation=True, max_length=512)
|
| 108 |
-
outputs = model(**inputs)
|
| 109 |
-
prediction = torch.argmax(outputs.logits, dim=1).item()
|
| 110 |
-
|
| 111 |
-
print(f"Classe predita: {prediction}")
|
| 112 |
-
```
|
| 113 |
-
|
| 114 |
-
## Treinamento
|
| 115 |
-
|
| 116 |
-
O modelo foi treinado com early stopping e validação cruzada em um dataset de documentos jurídicos brasileiros.
|
| 117 |
-
|
| 118 |
|
| 119 |
- **Developed by:** [More Information Needed]
|
| 120 |
- **Funded by [optional]:** [More Information Needed]
|
| 121 |
- **Shared by [optional]:** [More Information Needed]
|
| 122 |
- **Model type:** [More Information Needed]
|
| 123 |
-
- **Language(s) (NLP):**
|
| 124 |
-
- **License:**
|
| 125 |
- **Finetuned from model [optional]:** [More Information Needed]
|
| 126 |
|
| 127 |
### Model Sources [optional]
|
|
|
|
| 1 |
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
tags: []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
---
|
| 5 |
|
| 6 |
# Model Card for Model ID
|
|
|
|
| 15 |
|
| 16 |
<!-- Provide a longer summary of what this model is. -->
|
| 17 |
|
| 18 |
+
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
- **Developed by:** [More Information Needed]
|
| 21 |
- **Funded by [optional]:** [More Information Needed]
|
| 22 |
- **Shared by [optional]:** [More Information Needed]
|
| 23 |
- **Model type:** [More Information Needed]
|
| 24 |
+
- **Language(s) (NLP):** [More Information Needed]
|
| 25 |
+
- **License:** [More Information Needed]
|
| 26 |
- **Finetuned from model [optional]:** [More Information Needed]
|
| 27 |
|
| 28 |
### Model Sources [optional]
|
config.json
CHANGED
|
@@ -10,22 +10,23 @@
|
|
| 10 |
"hidden_dropout_prob": 0.1,
|
| 11 |
"hidden_size": 768,
|
| 12 |
"id2label": {
|
| 13 |
-
"0": "
|
| 14 |
-
"1": "
|
| 15 |
-
"2": "
|
| 16 |
-
"3": "
|
| 17 |
-
"4": "
|
| 18 |
-
"5": "
|
|
|
|
| 19 |
},
|
| 20 |
"initializer_range": 0.02,
|
| 21 |
"intermediate_size": 3072,
|
| 22 |
"label2id": {
|
| 23 |
-
"
|
| 24 |
-
"
|
| 25 |
-
"
|
| 26 |
-
"
|
| 27 |
-
"
|
| 28 |
-
"
|
| 29 |
},
|
| 30 |
"layer_norm_eps": 1e-12,
|
| 31 |
"max_position_embeddings": 512,
|
|
|
|
| 10 |
"hidden_dropout_prob": 0.1,
|
| 11 |
"hidden_size": 768,
|
| 12 |
"id2label": {
|
| 13 |
+
"0": "Alvar\u00e1",
|
| 14 |
+
"1": "Senten\u00e7a",
|
| 15 |
+
"2": "Penhora/Arresto/Sequestro",
|
| 16 |
+
"3": "Cita\u00e7\u00e3o",
|
| 17 |
+
"4": "Art.40",
|
| 18 |
+
"5": "N\u00e3o",
|
| 19 |
+
"6": "Alvar\u00e1"
|
| 20 |
},
|
| 21 |
"initializer_range": 0.02,
|
| 22 |
"intermediate_size": 3072,
|
| 23 |
"label2id": {
|
| 24 |
+
"Alvar\u00e1": 6,
|
| 25 |
+
"Art.40": 4,
|
| 26 |
+
"Cita\u00e7\u00e3o": 3,
|
| 27 |
+
"N\u00e3o": 5,
|
| 28 |
+
"Penhora/Arresto/Sequestro": 2,
|
| 29 |
+
"Senten\u00e7a": 1
|
| 30 |
},
|
| 31 |
"layer_norm_eps": 1e-12,
|
| 32 |
"max_position_embeddings": 512,
|
model.safetensors
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:ebbc0bde22fe9605d6b416bb40abfd1a9c25bb23293ebd059249447c5a5db0fb
|
| 3 |
-
size 711455760
|
|
|
|
|
|
|
|
|
|
|
|
special_tokens_map.json
CHANGED
|
@@ -1,7 +1,37 @@
|
|
| 1 |
{
|
| 2 |
-
"cls_token":
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"cls_token": {
|
| 3 |
+
"content": "[CLS]",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"mask_token": {
|
| 10 |
+
"content": "[MASK]",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": {
|
| 17 |
+
"content": "[PAD]",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"sep_token": {
|
| 24 |
+
"content": "[SEP]",
|
| 25 |
+
"lstrip": false,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
},
|
| 30 |
+
"unk_token": {
|
| 31 |
+
"content": "[UNK]",
|
| 32 |
+
"lstrip": false,
|
| 33 |
+
"normalized": false,
|
| 34 |
+
"rstrip": false,
|
| 35 |
+
"single_word": false
|
| 36 |
+
}
|
| 37 |
}
|