Legal FLAN-T5 Text Generation (Base)

Description

FLAN-T5 is an enhanced version of the original T5 model and is designed to produce better quality and more coherent text generation. It is trained on a large dataset of diverse texts and can generate high-quality summaries of articles, documents, and other text-based inputs. The model can also be utilized to generate legal texts.

Predicted Entities

Download Copy S3 URI

How to use

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

flant5 = legal.TextGenerator.pretrained('leggen_flant5_base','en','legal/models')\
    .setInputCols(["question"])\
    .setOutputCol("generated_text")
    .setMaxNewTokens(150)\
    .setStopAtEos(True)
  
pipeline = nlp.Pipeline(stages=[document_assembler, flant5])
data = spark.createDataFrame([
  [1, "Explain loan Clauses"]
]).toDF('id', 'text')
results = pipeline.fit(data).transform(data)
results.select("generated_text.result").show(truncate=False)

Results

+--------------------------------------------------------------------------------------------+
|result                                                                                      |
+--------------------------------------------------------------------------------------------+
|[Loan clauses are clauses in the U.S. Constitution that provide for the repayment of loans.]|
+--------------------------------------------------------------------------------------------+

Model Information

Model Name: leggen_flant5_base
Compatibility: Legal NLP 1.0.0+
License: Licensed
Edition: Official
Language: en
Size: 920.9 MB