Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,83 @@
|
|
1 |
---
|
2 |
license: mit
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
+
language:
|
4 |
+
- en
|
5 |
---
|
6 |
+
|
7 |
+
# STRONG Model Card
|
8 |
+
|
9 |
+
## Model Information
|
10 |
+
|
11 |
+
Summary description and brief definition of inputs and outputs.
|
12 |
+
|
13 |
+
### Description
|
14 |
+
|
15 |
+
STRONG is a finetuned LED-based model that can produce structure controllable summarization of long legal opinions obtained from CanLII.
|
16 |
+
|
17 |
+
You can also find the fine-tuned model without structure information [here](https://huggingface.co/yznlp/STRONG-LED-NoStructure).
|
18 |
+
|
19 |
+
### Usage
|
20 |
+
|
21 |
+
Below we share some code snippets on how to get quickly started with running the model. First make sure to `pip install -U transformers`, then copy the snippet from the section that is relevant for your usecase.
|
22 |
+
|
23 |
+
The input is composed of two parts:
|
24 |
+
1. Summary Structure Prompt: Concatenate a series of IRC structure labels using " | " as a separator. (labels include Non_IRC, Issue, Reason, Conclusion).
|
25 |
+
2. After the special token " ==> ", enter the text of the legal opinion.
|
26 |
+
|
27 |
+
#### Running the model on a CPU
|
28 |
+
|
29 |
+
|
30 |
+
```python
|
31 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
32 |
+
|
33 |
+
tokenizer = AutoTokenizer.from_pretrained("allenai/led-base-16384")
|
34 |
+
model = AutoModelForCausalLM.from_pretrained("yznlp/STRONG-LED")
|
35 |
+
|
36 |
+
input_text = "Non_IRC | Issue | Conclusion ==> {Legal Case Content}"
|
37 |
+
input_ids = tokenizer(input_text, return_tensors="pt")
|
38 |
+
|
39 |
+
outputs = model.generate(**input_ids, max_length=256, num_beams=4, length_penalty=2.0)
|
40 |
+
print(tokenizer.decode(outputs[0]))
|
41 |
+
```
|
42 |
+
|
43 |
+
|
44 |
+
#### Running the model on a single / multi GPU
|
45 |
+
|
46 |
+
|
47 |
+
```python
|
48 |
+
# pip install accelerate
|
49 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
50 |
+
|
51 |
+
tokenizer = AutoTokenizer.from_pretrained("allenai/led-base-16384")
|
52 |
+
model = AutoModelForCausalLM.from_pretrained("yznlp/STRONG-LED", device_map="auto")
|
53 |
+
|
54 |
+
input_text = "Non_IRC | Issue | Conclusion ==> {Legal Case Content}"
|
55 |
+
input_ids = tokenizer(input_text, return_tensors="pt")
|
56 |
+
|
57 |
+
outputs = model.generate(**input_ids, max_length=256, num_beams=4, length_penalty=2.0)
|
58 |
+
print(tokenizer.decode(outputs[0]))
|
59 |
+
```
|
60 |
+
|
61 |
+
### Paper Citation
|
62 |
+
If you find our model useful, please cite
|
63 |
+
```
|
64 |
+
@inproceedings{zhong-litman-2023-strong,
|
65 |
+
title = "{STRONG} {--} Structure Controllable Legal Opinion Summary Generation",
|
66 |
+
author = "Zhong, Yang and
|
67 |
+
Litman, Diane",
|
68 |
+
editor = "Park, Jong C. and
|
69 |
+
Arase, Yuki and
|
70 |
+
Hu, Baotian and
|
71 |
+
Lu, Wei and
|
72 |
+
Wijaya, Derry and
|
73 |
+
Purwarianti, Ayu and
|
74 |
+
Krisnadhi, Adila Alfa",
|
75 |
+
booktitle = "Findings of the Association for Computational Linguistics: IJCNLP-AACL 2023 (Findings)",
|
76 |
+
month = nov,
|
77 |
+
year = "2023",
|
78 |
+
address = "Nusa Dua, Bali",
|
79 |
+
publisher = "Association for Computational Linguistics",
|
80 |
+
url = "https://aclanthology.org/2023.findings-ijcnlp.37",
|
81 |
+
pages = "431--448",
|
82 |
+
}
|
83 |
+
```
|