T5 Clinical Summarization / QA model

Description

The T5 transformer model described in the seminal paper “Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer” can perform a variety of tasks, such as text summarization, question answering and translation. More details about using the model can be found in the paper (https://arxiv.org/pdf/1910.10683.pdf). This model is specifically trained on medical data for text summarization and question answering.

Predicted Entities

Copy S3 URI

How to use

document_assembler = DocumentAssembler()\
    .setInputCol("text")\
    .setOutputCol("documents")

t5 = T5Transformer().pretrained("t5_base_pubmedqa", "en", "clinical/models")\
    .setInputCols(["documents"])\
    .setOutputCol("t5_output")\
    .setTask("summarize medical questions:")\
    .setMaxOutputLength(200)

pipeline = Pipeline(stages=[document_assembler, t5])

data = spark.createDataFrame([
  [1, "content:SUBJECT: Normal physical traits but no period MESSAGE: I'm a 40 yr. old woman that has infantile reproductive organs and have never experienced a mensus. I have had Doctors look but they all say I just have infantile female reproductive organs. When I try to look for answers on the internet I cannot find anything. ALL my \"girly\" parts are normal. My organs never matured. Could you give me more information please. focus:all"]
]).toDF('id', 'text')

results = pipeline.fit(data).transform(data)

results.select("t5_output.result").show(truncate=False)
val document_assembler = new DocumentAssembler()
    .setInputCol("text")
    .setOutputCol("documents")

val t5 = T5Transformer()
    .pretrained("t5_base_pubmedqa", "en", "clinical/models")
    .setInputCols("documents")
    .setOutputCol("t5_output")
    .setTask("summarize medical questions:")
    .setMaxOutputLength(200)

val pipeline = new Pipeline().setStages(Array(document_assembler, t5))

val data = Seq(Array(
  (1, "content:SUBJECT: Normal physical traits but no period MESSAGE: I'm a 40 yr. old woman that has infantile reproductive organs and have never experienced a mensus. I have had Doctors look but they all say I just have infantile female reproductive organs. When I try to look for answers on the internet I cannot find anything. ALL my \"girly\" parts are normal. My organs never matured. Could you give me more information please. focus:all")
)).toDF("id", "text")

val results = pipeline.fit(data).transform(data)
import nlu
nlu.load("en.t5.base_pubmedqa").predict("""content:SUBJECT: Normal physical traits but no period MESSAGE: I'm a 40 yr. old woman that has infantile reproductive organs and have never experienced a mensus. I have had Doctors look but they all say I just have infantile female reproductive organs. When I try to look for answers on the internet I cannot find anything. ALL my \""")

Results

I have a normal physical appearance and have no mensus. Can you give me more information?

Model Information

Model Name: t5_base_pubmedqa
Compatibility: Spark NLP for Healthcare 4.1.0+
License: Licensed
Edition: Official
Input Labels: [documents]
Output Labels: [t5]
Language: en
Size: 916.7 MB

References

Trained on Pubmed data & qnli