The model is a fine-tuned version of GanjinZero/biobart-v2-base on PMC articles with a structured format
Note:
The model input is a set of sentences extracted by other sentence classifiers first, instead of directly using the full text of the section. The target output is the corresponding structured abstract.
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
# load model
model_name = 'fuhsiao/BioBART-PMC-EXT-Section'
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
# example
text = """ Suicide is a major challenge for the public health system, accounting for over 800,000 deaths each year worldwide.
Prisoners constitute such a risk group. Prisoners represent one extreme on the spectrum of delinquency, and are exposed to a particularly high risk of suicide, with suicide rates about 5 to 8 times higher than in the general population.
First, prisoners show behaviour and personality traits associated with suicide, even before imprisonment; these risk factors are imported into the prison environment.
The first weeks of imprisonment are particularly important for suicide prevention, since a considerable proportion of suicides in prisons occur during this period.
Only isolated studies have examined whether these factors are related to early suicide in prison, and these show a connection between drug addiction and early prison suicide.
To the best of our knowledge, this is the first study that uses a case-control design to investigate whether suicides in the first weeks of imprisonment differ from late prison suicide events in terms of their risk and resilience factors.
Previous prison sentences are negatively associated with early suicides, as this knowledge of the prison environment facilitates the process of re-adaptation.
Offences that are closely associated with drug use, such as theft, or offences against the narcotics law, are associated with early suicide events.
Evidence of mental illness or drug withdrawal is associated with early prison suicides. Assignment of a psychiatrist is protective against suicides during the first days of detention.
Risk factors change with increasing prison time. """
inputs = tokenizer(text, truncation=True, return_tensors='pt').input_ids
outputs = model.generate(inputs)
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)