Structure-control Legal Summarization
Collection
2 items
•
Updated
•
1
STRONG is a finetuned LED-based model that can produce a Structure Controllable summarization of long legal opinions obtained from CanLII.
You can also find the fine-tuned model without structure information here.
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.
The input is composed of two parts:
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("allenai/led-base-16384")
model = AutoModelForCausalLM.from_pretrained("yznlp/STRONG-LED")
input_text = "Non_IRC | Issue | Conclusion ==> {Legal Case Content}"
input_ids = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(**input_ids, max_length=256, num_beams=4, length_penalty=2.0)
print(tokenizer.decode(outputs[0]))
# pip install accelerate
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("allenai/led-base-16384")
model = AutoModelForCausalLM.from_pretrained("yznlp/STRONG-LED", device_map="auto")
input_text = "Non_IRC | Issue | Conclusion ==> {Legal Case Content}"
input_ids = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(**input_ids, max_length=256, num_beams=4, length_penalty=2.0)
print(tokenizer.decode(outputs[0]))
If you find our model useful, please cite
@inproceedings{zhong-litman-2023-strong,
title = "{STRONG} {--} Structure Controllable Legal Opinion Summary Generation",
author = "Zhong, Yang and
Litman, Diane",
editor = "Park, Jong C. and
Arase, Yuki and
Hu, Baotian and
Lu, Wei and
Wijaya, Derry and
Purwarianti, Ayu and
Krisnadhi, Adila Alfa",
booktitle = "Findings of the Association for Computational Linguistics: IJCNLP-AACL 2023 (Findings)",
month = nov,
year = "2023",
address = "Nusa Dua, Bali",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2023.findings-ijcnlp.37",
pages = "431--448",
}