Instructions to use law-ai/InLegalBERT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use law-ai/InLegalBERT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="law-ai/InLegalBERT")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForPreTraining tokenizer = AutoTokenizer.from_pretrained("law-ai/InLegalBERT") model = AutoModelForPreTraining.from_pretrained("law-ai/InLegalBERT", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -19,14 +19,23 @@ In total, our dataset contains around 5.4 million Indian legal documents (all in
|
|
| 19 |
The raw text corpus size is around 27 GB.
|
| 20 |
|
| 21 |
### Training Objective
|
| 22 |
-
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/)
|
| 23 |
|
| 24 |
### Usage
|
| 25 |
-
Using the tokenizer (same as LegalBERT
|
| 26 |
```python
|
| 27 |
-
from transformers import AutoTokenizer
|
| 28 |
-
tokenizer = AutoTokenizer.from_pretrained("
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
```
|
| 31 |
|
| 32 |
### Citation
|
|
|
|
| 19 |
The raw text corpus size is around 27 GB.
|
| 20 |
|
| 21 |
### Training Objective
|
| 22 |
+
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.
|
| 23 |
|
| 24 |
### Usage
|
| 25 |
+
Using the tokenizer (same as [LegalBERT](https://huggingface.co/nlpaueb/legal-bert-base-uncased))
|
| 26 |
```python
|
| 27 |
+
from transformers import AutoTokenizer
|
| 28 |
+
tokenizer = AutoTokenizer.from_pretrained("law-ai/InLegalBERT")
|
| 29 |
+
```
|
| 30 |
+
Using the model to get embeddings/representations for a sentence
|
| 31 |
+
```python
|
| 32 |
+
from transformers import AutoModel
|
| 33 |
+
model = AutoModel.from_pretrained("law-ai/InLegalBERT")
|
| 34 |
+
```
|
| 35 |
+
Using the model for further pre-training with MLM and NSP
|
| 36 |
+
```python
|
| 37 |
+
from transformers import BertForPreTraining
|
| 38 |
+
model_with_pretraining_heads = BertForPreTraining.from_pretrained("law-ai/InLegalBERT")
|
| 39 |
```
|
| 40 |
|
| 41 |
### Citation
|