Text Classification
Transformers
TensorBoard
Safetensors
bert
Generated from Trainer
text-embeddings-inference
Instructions to use xshubhamx/InLegalBERT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use xshubhamx/InLegalBERT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="xshubhamx/InLegalBERT")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("xshubhamx/InLegalBERT") model = AutoModelForSequenceClassification.from_pretrained("xshubhamx/InLegalBERT", device_map="auto") - Notebooks
- Google Colab
- Kaggle
| license: mit | |
| tags: | |
| - generated_from_trainer | |
| base_model: law-ai/InLegalBERT | |
| metrics: | |
| - accuracy | |
| - precision | |
| - recall | |
| model-index: | |
| - name: InLegalBERT | |
| results: [] | |
| ## Metrics | |
| - loss: 1.0342 | |
| - accuracy: 0.8359 | |
| - precision: 0.8409 | |
| - recall: 0.8359 | |
| - precision_macro: 0.8136 | |
| - recall_macro: 0.8000 | |
| - macro_fpr: 0.0142 | |
| - weighted_fpr: 0.0138 | |
| - weighted_specificity: 0.9792 | |
| - macro_specificity: 0.9877 | |
| - weighted_sensitivity: 0.8359 | |
| - macro_sensitivity: 0.8000 | |
| - f1_micro: 0.8359 | |
| - f1_macro: 0.8010 | |
| - f1_weighted: 0.8352 | |
| - runtime: 19.9583 | |
| - samples_per_second: 64.4340 | |
| - steps_per_second: 8.0670 | |
| ## Metrics | |
| - loss: 1.0345 | |
| - accuracy: 0.8358 | |
| - precision: 0.8408 | |
| - recall: 0.8358 | |
| - precision_macro: 0.8207 | |
| - recall_macro: 0.7957 | |
| - macro_fpr: 0.0143 | |
| - weighted_fpr: 0.0138 | |
| - weighted_specificity: 0.9790 | |
| - macro_specificity: 0.9877 | |
| - weighted_sensitivity: 0.8358 | |
| - macro_sensitivity: 0.7957 | |
| - f1_micro: 0.8358 | |
| - f1_macro: 0.8020 | |
| - f1_weighted: 0.8352 | |
| - runtime: 22.0569 | |
| - samples_per_second: 58.5300 | |
| - steps_per_second: 7.3450 | |
| <!-- This model card has been generated automatically according to the information the Trainer had access to. You | |
| should probably proofread and complete it, then remove this comment. --> | |
| # InLegalBERT | |
| This model is a fine-tuned version of [law-ai/InLegalBERT](https://huggingface.co/law-ai/InLegalBERT) on an unknown dataset. | |
| It achieves the following results on the evaluation set: | |
| - Loss: 1.0763 | |
| - Accuracy: 0.8304 | |
| - Precision: 0.8363 | |
| - Recall: 0.8304 | |
| - Precision Macro: 0.7959 | |
| - Recall Macro: 0.8029 | |
| - Macro Fpr: 0.0150 | |
| - Weighted Fpr: 0.0145 | |
| - Weighted Specificity: 0.9774 | |
| - Macro Specificity: 0.9871 | |
| - Weighted Sensitivity: 0.8296 | |
| - Macro Sensitivity: 0.8029 | |
| - F1 Micro: 0.8296 | |
| - F1 Macro: 0.7954 | |
| - F1 Weighted: 0.8283 | |
| ## 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: 5e-05 | |
| - train_batch_size: 8 | |
| - eval_batch_size: 8 | |
| - seed: 42 | |
| - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08 | |
| - lr_scheduler_type: linear | |
| - num_epochs: 15 | |
| - mixed_precision_training: Native AMP | |
| ### Training results | |
| | Training Loss | Epoch | Step | Validation Loss | Accuracy | Precision | Recall | Precision Macro | Recall Macro | Macro Fpr | Weighted Fpr | Weighted Specificity | Macro Specificity | Weighted Sensitivity | Macro Sensitivity | F1 Micro | F1 Macro | F1 Weighted | | |
| |:-------------:|:-----:|:----:|:---------------:|:--------:|:---------:|:------:|:---------------:|:------------:|:---------:|:------------:|:--------------------:|:-----------------:|:--------------------:|:-----------------:|:--------:|:--------:|:-----------:| | |
| | 1.065 | 1.0 | 643 | 0.6395 | 0.7994 | 0.7818 | 0.7994 | 0.6194 | 0.6308 | 0.0185 | 0.0176 | 0.9714 | 0.9847 | 0.7994 | 0.6308 | 0.7994 | 0.6029 | 0.7804 | | |
| | 0.5866 | 2.0 | 1286 | 0.6907 | 0.8187 | 0.8199 | 0.8187 | 0.7285 | 0.7366 | 0.0161 | 0.0156 | 0.9765 | 0.9864 | 0.8187 | 0.7366 | 0.8187 | 0.7276 | 0.8152 | | |
| | 0.4622 | 3.0 | 1929 | 0.8056 | 0.8180 | 0.8137 | 0.8180 | 0.7227 | 0.7376 | 0.0162 | 0.0156 | 0.9764 | 0.9863 | 0.8180 | 0.7376 | 0.8180 | 0.7283 | 0.8150 | | |
| | 0.2398 | 4.0 | 2572 | 0.9310 | 0.8172 | 0.8235 | 0.8172 | 0.7661 | 0.7425 | 0.0161 | 0.0157 | 0.9762 | 0.9862 | 0.8172 | 0.7425 | 0.8172 | 0.7407 | 0.8161 | | |
| | 0.1611 | 5.0 | 3215 | 1.0763 | 0.8304 | 0.8363 | 0.8304 | 0.8174 | 0.7918 | 0.0148 | 0.0144 | 0.9784 | 0.9873 | 0.8304 | 0.7918 | 0.8304 | 0.7986 | 0.8304 | | |
| | 0.1055 | 6.0 | 3858 | 1.1377 | 0.8257 | 0.8275 | 0.8257 | 0.8039 | 0.7810 | 0.0154 | 0.0149 | 0.9775 | 0.9869 | 0.8257 | 0.7810 | 0.8257 | 0.7863 | 0.8246 | | |
| | 0.0463 | 7.0 | 4501 | 1.3215 | 0.8071 | 0.8111 | 0.8071 | 0.7692 | 0.7689 | 0.0172 | 0.0168 | 0.9761 | 0.9856 | 0.8071 | 0.7689 | 0.8071 | 0.7661 | 0.8078 | | |
| | 0.031 | 8.0 | 5144 | 1.3483 | 0.8203 | 0.8170 | 0.8203 | 0.7773 | 0.7727 | 0.0161 | 0.0154 | 0.9751 | 0.9864 | 0.8203 | 0.7727 | 0.8203 | 0.7690 | 0.8175 | | |
| | 0.0202 | 9.0 | 5787 | 1.3730 | 0.8280 | 0.8263 | 0.8280 | 0.7818 | 0.7803 | 0.0152 | 0.0146 | 0.9779 | 0.9871 | 0.8280 | 0.7803 | 0.8280 | 0.7753 | 0.8256 | | |
| | 0.0133 | 10.0 | 6430 | 1.5407 | 0.8164 | 0.8163 | 0.8164 | 0.7688 | 0.7779 | 0.0165 | 0.0158 | 0.9751 | 0.9861 | 0.8164 | 0.7779 | 0.8164 | 0.7655 | 0.8135 | | |
| | 0.0051 | 11.0 | 7073 | 1.5235 | 0.8226 | 0.8265 | 0.8226 | 0.7900 | 0.7680 | 0.0156 | 0.0152 | 0.9769 | 0.9866 | 0.8226 | 0.7680 | 0.8226 | 0.7744 | 0.8234 | | |
| | 0.0027 | 12.0 | 7716 | 1.5643 | 0.8265 | 0.8259 | 0.8265 | 0.7805 | 0.7841 | 0.0154 | 0.0148 | 0.9772 | 0.9869 | 0.8265 | 0.7841 | 0.8265 | 0.7775 | 0.8245 | | |
| | 0.002 | 13.0 | 8359 | 1.5516 | 0.8280 | 0.8273 | 0.8280 | 0.7882 | 0.7902 | 0.0152 | 0.0146 | 0.9779 | 0.9871 | 0.8280 | 0.7902 | 0.8280 | 0.7860 | 0.8262 | | |
| | 0.0015 | 14.0 | 9002 | 1.5835 | 0.8273 | 0.8268 | 0.8273 | 0.7943 | 0.8022 | 0.0153 | 0.0147 | 0.9773 | 0.9870 | 0.8273 | 0.8022 | 0.8273 | 0.7943 | 0.8259 | | |
| | 0.0007 | 15.0 | 9645 | 1.5914 | 0.8296 | 0.8293 | 0.8296 | 0.7959 | 0.8029 | 0.0150 | 0.0145 | 0.9774 | 0.9871 | 0.8296 | 0.8029 | 0.8296 | 0.7954 | 0.8283 | | |
| ### Framework versions | |
| - Transformers 4.38.2 | |
| - Pytorch 2.1.2 | |
| - Datasets 2.1.0 | |
| - Tokenizers 0.15.2 | |