File size: 12,113 Bytes
41f1ee9
 
 
 
 
 
 
 
e34ee50
41f1ee9
 
 
 
 
e34ee50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41f1ee9
 
 
 
 
 
 
 
e34ee50
41f1ee9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e34ee50
41f1ee9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e34ee50
41f1ee9
 
 
e34ee50
 
 
41f1ee9
 
 
 
 
 
 
 
 
 
e34ee50
41f1ee9
 
 
e34ee50
 
41f1ee9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a0cde0f
 
 
 
 
 
e34ee50
41f1ee9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
---
library_name: span-marker
tags:
- span-marker
- token-classification
- ner
- named-entity-recognition
- generated_from_span_marker_trainer
- legal
metrics:
- precision
- recall
- f1
widget:
- text: >-
    The seven-judge Constitution Bench of the Supreme Court in SBP and Co.
    (supra) while reversing earlier five-judge Constitution Bench judgment in
    Konkan Railway Corpn. Ltd. vs. Rani Construction (P) Ltd., (2002) 2 SCC 388
    held that the power exercised by the Chief Justice of the High Court or the
    Chief justice of India under Section 11(6) of the Arbitration Act is not an
    administrative power but is a judicial power.
- text: >-
    In The High Court Of Judicature At Patna Criminal Writ Jurisdiction Case
    No.160 of 2021 Arising Out of Ps. Case No.-58 Year-2020 Thana- Bakhari
    District- Begusarai ======================================================
    Hanif Ur Rahman, son of Azhar Rahman, Resident of C-39, East Nizamuddin, New
    Delhi....... Petitioner Versus 1. The State of Bihar (through Chief
    Secretary, Govt. of Bihar) Main Secretariat, Patna - 800015. 2. Meena
    Khatoon, wife of Mastan @ Noor Mohammad, Resident of Village- Mansurpur
    Chaksikandar, P.S.- Bidupur, District- Vaishali (Bihar) 3. The Bihar Police,
    through Standing Counsel. 4. Child Welfare Committee, through Chairperson,
    Chanakyanagar, Mahmadpur, Begusarai. 5. The Superintendent, Alpawas Grih,
    Nirala Nagar, Behind G.D. College, Ratanpur, Begusarai....... Respondents
    ====================================================== Appearance:For the
    Petitioner:Ms. Kriti Awasthi, Advocate Mr. Sambhav Gupta, Advocate Mr.
    Navnit Kumar, Advocate Mr. Shyam Kumar, Advocate For the
    Respondents:Mr.Nadim Seraj, G.P.5 For the Resp. No. 2:Ms. Archana Sinha,
    Advocate For the Resp. No. 4:Mr. Prabhu Narain Sharma, Advocate
    ====================================================== Coram: Honourable Mr.
    Justice Rajeev Ranjan Prasad C.A.V. Judgment
- text: >-
    1 R In The High Court Of Karnataka At Bengaluru Dated This The 19Th Day Of
    February, 2021 Before The Hon'Ble Mr. Justice H.P. Sandesh Criminal Appeal
    No.176/2011 Between: Sri G.L. Jagadish, S/O Sri G.N. Lingappa, Aged About 52
    Years, Residing At No.29, 3Rd Main, Basaveshwara Housing Society Layout,
    Vijayanagar, Near Bts Depot, Bengaluru-40....Appellant [By Sri H.
    Ramachandra, Advocate For Sri H.R. Anantha Krishna Murthy And Associates -
    (Through V.C.)] And: Smt. Vasantha Kokila, W/O Late N.R. Somashekhar, Aged
    About 58 Years, Residing At No.322, 8Th Main, 3Rd Stage, 4Th Block,
    Basaveshwaranagar, Bengaluru....Respondent [By Sri K.R. Lakshminarayana Rao,
    Advocate] This Criminal Appeal Is Filed Under Section 378(4) Of Cr.P.C.
    Praying To Set Aside The Order Dated 06.07.2010 Passed By The P.O. Ftc-Ii,
    Bengaluru In Crl.A. No.470/2009 And Confirming The Order Dated 27.05.2009
    Passed By The Xxii Acmm And Xxiv Ascj, Bengaluru In C.C.No.17229/2004
    Convicting The Respondent/Accused For The Offence Punishable Under Section
    138 Of Ni Act. 2 This Criminal Appeal Having Been Heard And Reserved For
    Orders On 06.02.2021 This Day, The Court Pronounced The Following: Judgment
- text: >-
    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.
- text: >-
    Mr. Arun Bharadwaj, ld. CGSC, appearing for the Union of India, has
    Signature Not Verified Digitally Signed By:PRATHIBA M SINGH Signing
    Date:09.10.2020 16:15 Digitally Signed By:SINDHU KRISHNAKUMAR Signing
    Date:09.10.2020 16:50:02 reiterated the submissions made by Dr. Singhvi and
    has further submitted that this petition ought to be heard with the OA No.
    291/138/2020 pending before the CAT.
pipeline_tag: token-classification
model-index:
- name: SpanMarker
  results:
  - task:
      type: token-classification
      name: Named Entity Recognition
    dataset:
      name: legal_ner
      type: unknown
      split: eval
    metrics:
    - type: f1
      value: 0.9099756690997567
      name: F1
    - type: precision
      value: 0.9089703932832524
      name: Precision
    - type: recall
      value: 0.9109831709477414
      name: Recall
---

# SpanMarker

This is a [SpanMarker](https://github.com/tomaarsen/SpanMarkerNER) model that can be used for Named Entity Recognition. It was trained on the Legal NER Indian Justice dataset.

## Model Details

### Model Description
- **Model Type:** SpanMarker
<!-- - **Encoder:** [Unknown](https://huggingface.co/unknown) -->
- **Maximum Sequence Length:** 128 tokens
- **Maximum Entity Length:** 6 words
<!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
<!-- - **Language:** Unknown -->
<!-- - **License:** Unknown -->

### Model Sources

- **Repository:** [SpanMarker on GitHub](https://github.com/tomaarsen/SpanMarkerNER)
- **Thesis:** [SpanMarker For Named Entity Recognition](https://raw.githubusercontent.com/tomaarsen/SpanMarkerNER/main/thesis.pdf)

### Model Labels
| Label        | Examples                                                                                                                            |
|:-------------|:------------------------------------------------------------------------------------------------------------------------------------|
| CASE_NUMBER  | "Section 80", "Section 66 (1)", "Section 26-A"                                                                                      |
| COURT        | "(1962) 45 ITR 210 (SC)", "Writ Appeal No. 479 of 2005.", "CMA No. 6727 of 93"                                                      |
| DATE         | "A. SHANKAR NARAYANA", "B.N. Srikrishna,", "(Jarat"                                                                                 |
| GPE          | "Hongkong Bank", "HDFC Bank, Noida,", "Rahul & Co."                                                                                 |
| JUDGE        | "Chandigarh", "UP", "Lakhaya,"                                                                                                      |
| LAWYER       | "the", "Vijay Mishra", "Chandregowda"                                                                                               |
| ORG          | "The", "A. Sandeep", "For"                                                                                                          |
| OTHER_PERSON | "Indian Income-tax Act", "POTA", "Indian Income-tax Act, 1922,"                                                                     |
| PETITIONER   | "Supreme Court.", "Supreme Court,", "Sessions Judge Jaipur City,"                                                                   |
| PRECEDENT    | "C.C. Alavi Hazi Vs.Palapetty Mohd. & Anr", "Susamma Thomas, 1994 ACJ 1 (SC),", "United India Insurance Co. Ltd. v. Rajendra Singh" |
| PROVISION    | "Jagdish Prasad Sharma,", "Bhanwarial,", "Amarsingh,"                                                                               |
| RESPONDENT   | "19.8.1998", "28 March, 1959,", "29.4.1968,"                                                                                        |
| STATUTE      | "Kaur,", "Tarlochan Singh.", "Agya"                                                                                                 |
| WITNESS      | "Manju", "Sameer.", "Abid @ Guddu"                                                                                                  |

## Uses

### Direct Use for Inference

```python
from span_marker import SpanMarkerModel, SpanMarkerTokenizer

# Download from the 🤗 Hub
model = SpanMarkerModel.from_pretrained("lambdavi/span-marker-luke-legal")
tokenizer = SpanMarkerTokenizer.from_pretrained("roberta-base", config=model.tokenizer.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.")
```

### Downstream Use
You can finetune this model on your own dataset.

<details><summary>Click to expand</summary>

```python
from span_marker import SpanMarkerModel, Trainer, SpanMarkerTokenizer

# Download from the 🤗 Hub
model = SpanMarkerModel.from_pretrained("lambdavi/span-marker-luke-legal")
tokenizer = SpanMarkerTokenizer.from_pretrained("roberta-base", config=model.tokenizer.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 Details

### Training Set Metrics
| Training set          | Min | Median  | Max  |
|:----------------------|:----|:--------|:-----|
| Sentence length       | 3   | 44.5113 | 2795 |
| Entities per sentence | 0   | 2.7232  | 68   |

### Training Hyperparameters
- learning_rate: 0.0001
- train_batch_size: 8
- eval_batch_size: 8
- seed: 42
- gradient_accumulation_steps: 2
- total_train_batch_size: 16
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- lr_scheduler_warmup_ratio: 0.06
- num_epochs: 5

### Training Results
| 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 |

### Framework Versions
- Python: 3.10.12
- SpanMarker: 1.5.0
- Transformers: 4.36.0
- PyTorch: 2.0.0
- Datasets: 2.17.1
- Tokenizers: 0.15.0

## Citation

### BibTeX
```
@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.*
-->