Instructions to use microsoft/biogpt with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/biogpt with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="microsoft/biogpt")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("microsoft/biogpt") model = AutoModelForCausalLM.from_pretrained("microsoft/biogpt") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use microsoft/biogpt with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "microsoft/biogpt" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "microsoft/biogpt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/microsoft/biogpt
- SGLang
How to use microsoft/biogpt with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "microsoft/biogpt" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "microsoft/biogpt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "microsoft/biogpt" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "microsoft/biogpt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use microsoft/biogpt with Docker Model Runner:
docker model run hf.co/microsoft/biogpt
First-pass at putting current summary in Model Card format
Browse filesThis takes the writing that was already here and organizes it into the Model Card protocol.
Still more work to do, but it makes information about the model more easily findable.
README.md
CHANGED
|
@@ -2,12 +2,31 @@
|
|
| 2 |
language: en
|
| 3 |
license: mit
|
| 4 |
widget:
|
| 5 |
-
- text:
|
|
|
|
|
|
|
|
|
|
| 6 |
---
|
| 7 |
|
| 8 |
-
#
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
You can use this model directly with a pipeline for text generation. Since the generation relies on some randomness, we
|
| 13 |
set a seed for reproducibility:
|
|
@@ -63,6 +82,36 @@ tokenizer.decode(beam_output[0], skip_special_tokens=True)
|
|
| 63 |
'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.'
|
| 64 |
```
|
| 65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
## Citation
|
| 67 |
|
| 68 |
If you find BioGPT useful in your research, please cite the following paper:
|
|
@@ -83,4 +132,4 @@ If you find BioGPT useful in your research, please cite the following paper:
|
|
| 83 |
note = {bbac409},
|
| 84 |
eprint = {https://academic.oup.com/bib/article-pdf/23/6/bbac409/47144271/bbac409.pdf},
|
| 85 |
}
|
| 86 |
-
```
|
|
|
|
| 2 |
language: en
|
| 3 |
license: mit
|
| 4 |
widget:
|
| 5 |
+
- text: COVID-19 is
|
| 6 |
+
metrics:
|
| 7 |
+
- accuracy
|
| 8 |
+
- f1
|
| 9 |
---
|
| 10 |
|
| 11 |
+
# Model Card for BioGPT
|
| 12 |
|
| 13 |
+
BioGPT is a domain-specific generative Transformer language model pre-trained on large-scale biomedical literature.
|
| 14 |
+
|
| 15 |
+
## Model Details
|
| 16 |
+
|
| 17 |
+
### Model Description
|
| 18 |
+
|
| 19 |
+
Pre-trained language models have attracted increasing attention in the biomedical domain,
|
| 20 |
+
inspired by their great success in the general natural language domain.
|
| 21 |
+
Among the two main branches of pre-trained language models in the general language domain,
|
| 22 |
+
i.e., BERT (and its variants) and GPT (and its variants), the first one has been extensively studied in the biomedical domain,
|
| 23 |
+
such as BioBERT and PubMedBERT. While they have achieved great success on a variety of discriminative downstream biomedical tasks,
|
| 24 |
+
the lack of generation ability constrains their application scope.
|
| 25 |
+
|
| 26 |
+
BioGPT addresses the need for generation abilities, implemented as a domain-specific generative Transformer language model
|
| 27 |
+
pre-trained on large-scale biomedical literature.
|
| 28 |
+
|
| 29 |
+
### How to Get Started with the Model
|
| 30 |
|
| 31 |
You can use this model directly with a pipeline for text generation. Since the generation relies on some randomness, we
|
| 32 |
set a seed for reproducibility:
|
|
|
|
| 82 |
'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.'
|
| 83 |
```
|
| 84 |
|
| 85 |
+
|
| 86 |
+
## Evaluation
|
| 87 |
+
|
| 88 |
+
### Testing Data, Factors & Metrics
|
| 89 |
+
|
| 90 |
+
#### Testing Data
|
| 91 |
+
|
| 92 |
+
<!-- This should link to a Data Card if possible. -->
|
| 93 |
+
|
| 94 |
+
Six biomedical natural language processing tasks.
|
| 95 |
+
|
| 96 |
+
#### Metrics
|
| 97 |
+
|
| 98 |
+
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 99 |
+
|
| 100 |
+
- F1, for end-to-end relation extraction tasks
|
| 101 |
+
- Accuracy, on PubMedQA
|
| 102 |
+
|
| 103 |
+
### Results
|
| 104 |
+
|
| 105 |
+
The model achieves 44.98%, 38.42% and 40.76% F1 score on BC5CDR, KD-DTI and DDI end-to-end relation extraction tasks,
|
| 106 |
+
respectively, and 78.2% accuracy on PubMedQA, creating a new record.
|
| 107 |
+
|
| 108 |
+
#### Summary
|
| 109 |
+
|
| 110 |
+
This model outperforms previous models on most evaluated tasks.
|
| 111 |
+
|
| 112 |
+
Our case study on text generation further demonstrates the advantage of BioGPT on biomedical literature to
|
| 113 |
+
generate fluent descriptions for biomedical terms.
|
| 114 |
+
|
| 115 |
## Citation
|
| 116 |
|
| 117 |
If you find BioGPT useful in your research, please cite the following paper:
|
|
|
|
| 132 |
note = {bbac409},
|
| 133 |
eprint = {https://academic.oup.com/bib/article-pdf/23/6/bbac409/47144271/bbac409.pdf},
|
| 134 |
}
|
| 135 |
+
```
|