Structure-control Legal Summarization
Collection
2 items
•
Updated
•
1
Summary description and a brief definition of inputs and outputs.
STRONG-NoStructure is the baseline LED-based model that can produce the summarization of long legal opinions obtained from CanLII.
You can also find the Structure-Controlled fine-tuned model STRONG-LED 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 includes text of the legal opinion.
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("allenai/led-base-16384")
model = AutoModelForCausalLM.from_pretrained("yznlp/STRONG-LED-NoStructure")
input_text = "{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-NoStructure", device_map="auto")
input_text = "{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",
}