ss108 commited on
Commit
64f6426
1 Parent(s): ba67dcd

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +30 -3
README.md CHANGED
@@ -1,3 +1,30 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ ---
4
+ This is a NER model meant to be used to detect/extract citations from American legal documents.
5
+
6
+ Ignore the widget on the model card page; see below for usage.
7
+
8
+ ## How to Use the Model
9
+
10
+ This model outputs token-level predictions, which should be processed as follows to obtain meaningful labels for each token:
11
+
12
+ ```python
13
+ from transformers import AutoTokenizer, AutoModelForTokenClassification
14
+ import torch
15
+
16
+ tokenizer = AutoTokenizer.from_pretrained("ss108/legal-citation-bert")
17
+ model = AutoModelForTokenClassification.from_pretrained("ss108/legal-citation-bert")
18
+
19
+ text = "Your example text here"
20
+ inputs = tokenizer(text, return_tensors="pt", padding=True)
21
+ outputs = model(**inputs)
22
+
23
+ logits = outputs.logits
24
+ predictions = torch.argmax(logits, dim=-1)
25
+
26
+ tokens = tokenizer.convert_ids_to_tokens(inputs['input_ids'][0])
27
+ predicted_labels = [model.config.id2label[p.item()] for p in predictions[0]]
28
+
29
+ for token, label in zip(tokens, predicted_labels):
30
+ print(f"{token}: {label}")