Instructions to use LineLS/LegalBERT-optimized with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LineLS/LegalBERT-optimized with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="LineLS/LegalBERT-optimized")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("LineLS/LegalBERT-optimized") model = AutoModelForTokenClassification.from_pretrained("LineLS/LegalBERT-optimized", device_map="auto") - Notebooks
- Google Colab
- Kaggle
LegalBERT-optimized
This model is a fine-tuned version of nlpaueb/legal-bert-base-uncased on the None dataset. It achieves the following results on the evaluation set:
- Loss: 0.0830
- Precision: 0.8803
- Recall: 0.8803
- F1: 0.8803
- Accuracy: 0.9646
Model description
More information needed
Intended uses & limitations
More information needed
Training and evaluation data
More information needed
Training procedure
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 2.325564413937065e-05
- train_batch_size: 8
- eval_batch_size: 8
- seed: 42
- optimizer: Use OptimizerNames.ADAMW_TORCH with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
- lr_scheduler_type: linear
- num_epochs: 11
Training results
| Training Loss | Epoch | Step | Validation Loss | Precision | Recall | F1 | Accuracy |
|---|---|---|---|---|---|---|---|
| 0.1818 | 1.0 | 3013 | 0.1618 | 0.7850 | 0.7869 | 0.7860 | 0.9383 |
| 0.1335 | 2.0 | 6026 | 0.1285 | 0.8313 | 0.8317 | 0.8315 | 0.9515 |
| 0.1107 | 3.0 | 9039 | 0.1042 | 0.8534 | 0.8538 | 0.8536 | 0.9577 |
| 0.0953 | 4.0 | 12052 | 0.1026 | 0.8673 | 0.8673 | 0.8673 | 0.9613 |
| 0.0887 | 5.0 | 15065 | 0.0939 | 0.8668 | 0.8668 | 0.8668 | 0.9606 |
| 0.0851 | 6.0 | 18078 | 0.0955 | 0.8701 | 0.8694 | 0.8698 | 0.9618 |
| 0.0844 | 7.0 | 21091 | 0.0847 | 0.8683 | 0.8683 | 0.8683 | 0.9616 |
| 0.0804 | 8.0 | 24104 | 0.0862 | 0.8765 | 0.8765 | 0.8765 | 0.9638 |
| 0.081 | 9.0 | 27117 | 0.0857 | 0.8746 | 0.8746 | 0.8746 | 0.9633 |
| 0.0785 | 10.0 | 30130 | 0.0837 | 0.8748 | 0.8748 | 0.8748 | 0.9633 |
| 0.0765 | 11.0 | 33143 | 0.0834 | 0.8735 | 0.8735 | 0.8735 | 0.9630 |
Framework versions
- Transformers 4.52.4
- Pytorch 2.6.0+cu124
- Datasets 2.14.4
- Tokenizers 0.21.1
- Downloads last month
- 10
Model tree for LineLS/LegalBERT-optimized
Base model
nlpaueb/legal-bert-base-uncased