Legal Finetuned FLAN-T5 Text Generation

Description

This Text Generation model has been fine-tuned on FLANT5 Using legal texts. FLAN-T5 is a state-of-the-art language model developed by Facebook AI that utilizes the T5 architecture for text generation tasks.

Predicted Entities

Download Copy S3 URI

How to use


document_assembler = nlp.DocumentAssembler()\
    .setInputCol("text")\
    .setOutputCol("question")

flant5 = legal.TextGenerator.pretrained('leggen_flant5_finetuned,'en','legal/models')\
    .setInputCols(["question"])\
    .setOutputCol("generated_text")
    .setMaxNewTokens(150)\
    .setStopAtEos(True)
  
pipeline = nlp.Pipeline(stages=[document_assembler, flant5])

data = spark.createDataFrame([
  [1,'''This exhibit has been redacted and is the subject of a confidential treatment request. redacted material is marked with [* * *] and has been filed separately with the securities and exchange commission. this agreement (this "agreement"), dated december 30, 2016 (the "effective date"), is''']
]).toDF('id', 'text')
results = pipeline.fit(data).transform(data)
results.select("generated_text.result").show(truncate=False)

Results

+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|result                                                                                                                                                                                                                                                                                                                                                                                             |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|[The parties agree that this Agreement shall be binding upon and inure to the benefit of the parties, their successors and assigns. The parties further agree that any disputes arising out of or related to this Agreement shall be resolved through binding arbitration. The parties agree to submit to binding arbitration in accordance with the rules of the American Arbitration Association]|
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Model Information

Model Name: leggen_flant5_finetuned
Compatibility: Legal NLP 1.0.0+
License: Licensed
Edition: Official
Language: en
Size: 1.6 GB

References

In house annotated data