Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: en
|
3 |
+
pipeline_tag: fill-mask
|
4 |
+
tags:
|
5 |
+
- legal
|
6 |
+
license: mit
|
7 |
+
---
|
8 |
+
|
9 |
+
### InLegalBERT
|
10 |
+
Model and tokenizer files for the InLegalBERT model from the paper [Pre-training Transformers on Indian Legal Text](https://arxiv.org/abs/2209.06049).
|
11 |
+
|
12 |
+
### Training Data
|
13 |
+
For building the pre-training corpus of Indian legal text, we collected a large corpus of case documents from the Indian Supreme Court and many High Courts of India.
|
14 |
+
The court cases in our dataset range from 1950 to 2019, and belong to all legal domains, such as Civil, Criminal, Constitutional, and so on.
|
15 |
+
In total, our dataset contains around 5.4 million Indian legal documents (all in the English language).
|
16 |
+
The raw text corpus size is around 27 GB.
|
17 |
+
|
18 |
+
### Training Setup
|
19 |
+
This model is initialized with the [LEGAL-BERT-SC model](https://huggingface.co/nlpaueb/legal-bert-base-uncased) from the paper [LEGAL-BERT: The Muppets straight out of Law School](https://aclanthology.org/2020.findings-emnlp.261/). In our work, we refer to this model as LegalBERT, and our re-trained model as InLegalBERT.
|
20 |
+
We further train this model on our data for 300K steps on the Masked Language Modeling (MLM) and Next Sentence Prediction (NSP) tasks.
|
21 |
+
|
22 |
+
### Model Overview
|
23 |
+
This model uses a custom tokenizer with vocabulary adapted for the Indian Legal domain.
|
24 |
+
This model has the same configuration as the [bert-base-uncased model](https://huggingface.co/bert-base-uncased):
|
25 |
+
12 hidden layers, 768 hidden dimensionality, 12 attention heads, ~110M parameters.
|
26 |
+
|
27 |
+
### Usage
|
28 |
+
Using the model to get embeddings/representations for a piece of text
|
29 |
+
```python
|
30 |
+
from transformers import AutoTokenizer, AutoModel
|
31 |
+
tokenizer = AutoTokenizer.from_pretrained("law-ai/CustomInLawBERT")
|
32 |
+
text = "Replace this string with yours"
|
33 |
+
encoded_input = tokenizer(text, return_tensors="pt")
|
34 |
+
model = AutoModel.from_pretrained("law-ai/InLegalBERT")
|
35 |
+
output = model(**encoded_input)
|
36 |
+
last_hidden_state = output.last_hidden_state
|
37 |
+
```
|
38 |
+
|
39 |
+
### Fine-tuning Results
|
40 |
+
We have fine-tuned all pre-trained models on 3 legal tasks with Indian datasets:
|
41 |
+
* Legal Statute Identification ([ILSI Dataset](https://arxiv.org/abs/2112.14731))[Multi-label Text Classification]: Identifying relevant statutes (law articles) based on the facts of a court case
|
42 |
+
* Semantic Segmentation ([ISS Dataset](https://arxiv.org/abs/1911.05405))[Sentence Tagging]: Segmenting the document into 7 functional parts (semantic segments) such as Facts, Arguments, etc.
|
43 |
+
* Court Judgment Prediction ([ILDC Dataset](https://arxiv.org/abs/2105.13562))[Binary Text Classification]: Predicting whether the claims/petitions of a court case will be accepted/rejected
|
44 |
+
|
45 |
+
|
46 |
+
### Citation
|
47 |
+
```
|
48 |
+
@article{paul-2022-pretraining,
|
49 |
+
doi = {10.48550/ARXIV.2209.06049},
|
50 |
+
url = {https://arxiv.org/abs/2209.06049},
|
51 |
+
author = {Paul, Shounak and Mandal, Arpan and Goyal, Pawan and Ghosh, Saptarshi},
|
52 |
+
title = {Pre-training Transformers on Indian Legal Text},
|
53 |
+
publisher = {arXiv},
|
54 |
+
year = {2022},
|
55 |
+
copyright = {Creative Commons Attribution 4.0 International}
|
56 |
+
}
|
57 |
+
```
|
58 |
+
|
59 |
+
### About Us
|
60 |
+
We are a group of researchers from the Department of Computer Science and Technology, Indian Insitute of Technology, Kharagpur.
|
61 |
+
Our research interests are primarily ML and NLP applications for the legal domain, with a special focus on the challenges and oppurtunites for the Indian legal scenario.
|
62 |
+
We have, and are currently working on several legal tasks such as:
|
63 |
+
* named entity recognition, summarization of legal documents
|
64 |
+
* semantic segmentation of legal documents
|
65 |
+
* legal statute identification from facts, court judgment prediction
|
66 |
+
* legal document matching
|
67 |
+
|
68 |
+
You can find our publicly available codes and datasets [here](https://github.com/Law-AI).
|