kamalkraj commited on
Commit
2c5ef04
1 Parent(s): 723c5ce

updated model card

Browse files
Files changed (1) hide show
  1. README.md +79 -0
README.md CHANGED
@@ -1,3 +1,82 @@
1
  ---
 
2
  license: mit
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language: en
3
  license: mit
4
  ---
5
+
6
+ ## BioGPT
7
+
8
+ Pre-trained language models have attracted increasing attention in the biomedical domain, inspired by their great success in the general natural language domain. Among the two main branches of pre-trained language models in the general language domain, i.e. BERT (and its variants) and GPT (and its variants), the first one has been extensively studied in the biomedical domain, such as BioBERT and PubMedBERT. While they have achieved great success on a variety of discriminative downstream biomedical tasks, the lack of generation ability constrains their application scope. In this paper, we propose BioGPT, a domain-specific generative Transformer language model pre-trained on large-scale biomedical literature. We evaluate BioGPT on six biomedical natural language processing tasks and demonstrate that our model outperforms previous models on most tasks. Especially, we get 44.98%, 38.42% and 40.76% F1 score on BC5CDR, KD-DTI and DDI end-to-end relation extraction tasks, respectively, and 78.2% accuracy on PubMedQA, creating a new record. Our case study on text generation further demonstrates the advantage of BioGPT on biomedical literature to generate fluent descriptions for biomedical terms.
9
+
10
+ You can use this model directly with a pipeline for text generation. Since the generation relies on some randomness, we
11
+ set a seed for reproducibility:
12
+
13
+ ```python
14
+ >>> from transformers import pipeline, set_seed
15
+ >>> from transformers import BioGptTokenizer, BioGptLMHeadModel
16
+ >>> model = BioGptLMHeadModel.from_pretrained("kamalkraj/biogpt")
17
+ >>> tokenizer = BioGptTokenizer.from_pretrained("kamalkraj/biogpt")
18
+ >>> generator = pipeline('text-generation', model=model, tokenizer=tokenizer)
19
+ >>> set_seed(42)
20
+ >>> generator("COVID-19 is", max_length=20, num_return_sequences=5, do_sample=True)
21
+ [{'generated_text': 'COVID-19 is a respiratory disease, caused by the new coronavirus SARS-CoV-2.'},
22
+ {'generated_text': 'COVID-19 is severe and can result in acute respiratory distress syndrome and multi-system organ failure requiring'},
23
+ {'generated_text': 'COVID-19 is a serious public health emergency.'},
24
+ {'generated_text': 'COVID-19 is a rapidly emerging global pandemic and more effective therapies may be needed to manage the infection'},
25
+ {'generated_text': 'COVID-19 is associated with the use of the cytokine-induced neutrophil chemoattractant (CINC),'}]
26
+ ```
27
+
28
+ Here is how to use this model to get the features of a given text in PyTorch:
29
+
30
+ ```python
31
+ from transformers import BioGptTokenizer, BioGptModel
32
+ tokenizer = BioGptTokenizer.from_pretrained("kamalkraj/biogpt")
33
+ model = BioGptModel.from_pretrained("kamalkraj/biogpt")
34
+ text = "Replace me by any text you'd like."
35
+ encoded_input = tokenizer(text, return_tensors='pt')
36
+ output = model(**encoded_input)
37
+ ```
38
+
39
+ Beam-search decoding:
40
+
41
+ ```python
42
+ from transformers import BioGptTokenizer, BioGptLMHeadModel, set_seed
43
+
44
+ tokenizer = BioGptTokenizer.from_pretrained("kamalkraj/biogpt")
45
+ model = BioGptLMHeadModel.from_pretrained("kamalkraj/biogpt")
46
+
47
+ sentence = "COVID-19 is"
48
+ inputs = tokenizer(sentence, return_tensors="pt")
49
+
50
+ set_seed(42)
51
+
52
+ beam_output = model.generate(**inputs,
53
+ min_length=100,
54
+ max_length=1024,
55
+ num_beams=5,
56
+ early_stopping=True
57
+ )
58
+ tokenizer.decode(beam_output[0], skip_special_tokens=True)
59
+ 'COVID-19 is a global pandemic caused by severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2), the causative agent of coronavirus disease 2019 (COVID-19), which has spread to more than 200 countries and territories, including the United States (US), Canada, Australia, New Zealand, the United Kingdom (UK), and the United States of America (USA), as of March 11, 2020, with more than 800,000 confirmed cases and more than 800,000 deaths.'
60
+ ```
61
+
62
+ ## Citation
63
+
64
+ If you find PubMedBERT useful in your research, please cite the following paper:
65
+
66
+ ```latex
67
+ @article{10.1093/bib/bbac409,
68
+ author = {Luo, Renqian and Sun, Liai and Xia, Yingce and Qin, Tao and Zhang, Sheng and Poon, Hoifung and Liu, Tie-Yan},
69
+ title = "{BioGPT: generative pre-trained transformer for biomedical text generation and mining}",
70
+ journal = {Briefings in Bioinformatics},
71
+ volume = {23},
72
+ number = {6},
73
+ year = {2022},
74
+ month = {09},
75
+ abstract = "{Pre-trained language models have attracted increasing attention in the biomedical domain, inspired by their great success in the general natural language domain. Among the two main branches of pre-trained language models in the general language domain, i.e. BERT (and its variants) and GPT (and its variants), the first one has been extensively studied in the biomedical domain, such as BioBERT and PubMedBERT. While they have achieved great success on a variety of discriminative downstream biomedical tasks, the lack of generation ability constrains their application scope. In this paper, we propose BioGPT, a domain-specific generative Transformer language model pre-trained on large-scale biomedical literature. We evaluate BioGPT on six biomedical natural language processing tasks and demonstrate that our model outperforms previous models on most tasks. Especially, we get 44.98\%, 38.42\% and 40.76\% F1 score on BC5CDR, KD-DTI and DDI end-to-end relation extraction tasks, respectively, and 78.2\% accuracy on PubMedQA, creating a new record. Our case study on text generation further demonstrates the advantage of BioGPT on biomedical literature to generate fluent descriptions for biomedical terms.}",
76
+ issn = {1477-4054},
77
+ doi = {10.1093/bib/bbac409},
78
+ url = {https://doi.org/10.1093/bib/bbac409},
79
+ note = {bbac409},
80
+ eprint = {https://academic.oup.com/bib/article-pdf/23/6/bbac409/47144271/bbac409.pdf},
81
+ }
82
+ ```