Downloads · 30 days
8
1% of all-time downloads
lambdavi/span-marker-luke-legal
span-marker-luke-legal is a token classification model from lambdavi. Use it when you need labels on individual words, such as names. It is set up for span-marker.
This is a SpanMarker model that can be used for Named Entity Recognition. It was trained on the Legal NER Indian Justice dataset.
Downloads · 30 days
8
1% of all-time downloads
All-time downloads
545
Public
Parameters
275M
5.5 GB on disk
Likes
3
Public
Click a slice to open those files.
.safetensors1.1 GB · 100%
From the Hugging Face model README
This is a SpanMarker model that can be used for Named Entity Recognition. It was trained on the Legal NER Indian Justice dataset.
Official repository of the model: Github Link
Repository: SpanMarker on GitHub
Thesis: SpanMarker For Named Entity Recognition
|
from span_marker import SpanMarkerModel
from span_marker.tokenizer import SpanMarkerTokenizer
# Download from the 🤗 Hub
model = SpanMarkerModel.from_pretrained("lambdavi/span-marker-luke-legal")
tokenizer = SpanMarkerTokenizer.from_pretrained("roberta-base", config=model.config)
model.set_tokenizer(tokenizer)
# Run inference
entities = model.predict("The petition was filed through Sh. Vijay Pahwa, General Power of Attorney and it was asserted in the petition under Section 13-B of the Rent Act that 1 of 23 50% share of the demised premises had been purchased by the landlord from Sh. Vinod Malhotra vide sale deed No.4226 registered on 20.12.2007 with Sub Registrar, Chandigarh.")
You can finetune this model on your own dataset.
<details><summary>Click to expand</summary>from span_marker import SpanMarkerModel, Trainer
from span_marker.tokenizer import SpanMarkerTokenizer
# Download from the 🤗 Hub
model = SpanMarkerModel.from_pretrained("lambdavi/span-marker-luke-legal")
tokenizer = SpanMarkerTokenizer.from_pretrained("roberta-base", config=model.config)
model.set_tokenizer(tokenizer)
# Specify a Dataset with "tokens" and "ner_tag" columns
dataset = load_dataset("conll2003") # For example CoNLL2003
# Initialize a Trainer using the pretrained model & dataset
trainer = Trainer(
model=model,
train_dataset=dataset["train"],
eval_dataset=dataset["validation"],
)
trainer.train()
trainer.save_model("lambdavi/span-marker-luke-legal-finetuned")
</details>
<!--
### Out-of-Scope Use
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
-->
<!--
## Bias, Risks and Limitations
*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
-->
<!--
### Recommendations
*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
-->
| Training set | Min | Median | Max |
|---|---|---|---|
| Sentence length | 3 | 44.5113 | 2795 |
| Entities per sentence | 0 | 2.7232 | 68 |
| Epoch | Step | Validation Loss | Validation Precision | Validation Recall | Validation F1 | Validation Accuracy |
|---|---|---|---|---|---|---|
| 0.9997 | 1837 | 0.0137 | 0.7773 | 0.7994 | 0.7882 | 0.9577 |
| 2.0 | 3675 | 0.0090 | 0.8751 | 0.8348 | 0.8545 | 0.9697 |
| 2.9997 | 5512 | 0.0077 | 0.8777 | 0.8959 | 0.8867 | 0.9770 |
| 4.0 | 7350 | 0.0061 | 0.8941 | 0.9083 | 0.9011 | 0.9811 |
| 4.9986 | 9185 | 0.0064 | 0.9090 | 0.9110 | 0.9100 | 0.9824 |
| Metric | Value |
|---|---|
| f1-exact | 0.9237 |
| f1-strict | 0.9100 |
| f1-partial | 0.9365 |
| f1-type-match | 0.9277 |
@software{Aarsen_SpanMarker,
author = {Aarsen, Tom},
license = {Apache-2.0},
title = {{SpanMarker for Named Entity Recognition}},
url = {https://github.com/tomaarsen/SpanMarkerNER}
}
<!--
## Glossary
*Clearly define terms in order to be accessible across audiences.*
-->
<!--
## Model Card Authors
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
-->
<!--
## Model Card Contact
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
-->