STRONG-LED / README.md
yznlp's picture
Update README.md
0c5d27a verified
metadata
license: mit
language:
  - en

STRONG Model Card

Model Information

Description

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.

Usage

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:

  1. Summary Structure Prompt: Concatenate a series of IRC structure labels using " | " as a separator. (labels include Non_IRC, Issue, Reason, Conclusion).
  2. After the special token " ==> ", enter the text of the legal opinion.

Running the model on a CPU

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]))

Running the model on a single / multi GPU

# 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]))

Paper Citation

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",
}