Instructions to use PharMolix/BioMedGPT-LM-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use PharMolix/BioMedGPT-LM-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="PharMolix/BioMedGPT-LM-7B")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("PharMolix/BioMedGPT-LM-7B") model = AutoModelForCausalLM.from_pretrained("PharMolix/BioMedGPT-LM-7B", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use PharMolix/BioMedGPT-LM-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "PharMolix/BioMedGPT-LM-7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PharMolix/BioMedGPT-LM-7B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/PharMolix/BioMedGPT-LM-7B
- SGLang
How to use PharMolix/BioMedGPT-LM-7B 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 "PharMolix/BioMedGPT-LM-7B" \ --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": "PharMolix/BioMedGPT-LM-7B", "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 "PharMolix/BioMedGPT-LM-7B" \ --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": "PharMolix/BioMedGPT-LM-7B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use PharMolix/BioMedGPT-LM-7B with Docker Model Runner:
docker model run hf.co/PharMolix/BioMedGPT-LM-7B
license: apache-2.0
tags:
- medical
datasets:
- biomed
BioMedGPT-LM-7B
BioMedGPT-LM-7B is the first large generative language model based on Llama2 in the biomedical domain. It was fine-tuned from the Llama2-7B-Chat with millions of biomedical papers from the S2ORC corpus. Through further fine-tuning, BioMedGPT-LM-7B outperforms or is on par with human and significantly larger general-purpose foundation models on several biomedical QA benchmarks.
Training Details
The model was trained with the following hyperparameters:
- Epochs: 5
- Batch size: 192
- Context length: 2048
- Learning rate: 2e-5
BioMedGPT-LM-7B is finetuned on over 26 billion tokens highly pertinent to the field of biomedicine. The fine-tuning data are extracted from 5.5 million biomedical papers in S2ORC data using PubMed Central (PMC)-ID and PubMed ID as criteria.
Model Developers
PharMolix
How to Use
BioMedGPT-LM-7B is the generative language model of BioMedGPT-10B, an open-source version of BioMedGPT. BioMedGPT is an open multimodal generative pre-trained transformer (GPT) for biomedicine, which bridges the natural language modality and diverse biomedical data modalities via large generative language models.
More technical details of BioMedGPT-LM-7B, BioMedGPT-10B, and BioMedGPT can be found in the technical report.
Intended Use Cases
| Method | Parameters (B) | Setting | MedMCQA(%) | PubMedQA(%) |
|---|---|---|---|---|
| Human (pass)* | - | Manual | - | 60.0 |
| Human (expert)* | - | Manual | 90 | 78.0 |
| ------------------------ | ---------------- | ----------- | ------------- | -------------- |
| InstructGPT* | 175 | zero-shot | 44.0 | 73.2 |
| ChatGPT* | - | zero-shot | 44.7 | 63.9 |
| Llama* | 7 | zero-shot | 24.3 | 5.2 |
| Llama2 | 7 | zero-shot | 30.6 | 3.7 |
| Llama2-Chat | 7 | zero-shot | 35.5 | 21.9 |
| ------------------------ | ---------------- | --------- | ------------- | -------------- |
| Llama | 7 | Fine-tuing | 48.2 | 73.4 |
| Llama2-Chat | 7 | Fine-tuing | 48.3 | 75.5 |
| PMC-Llama | 7 | Fine-tuing | 50.5 | 69.5 |
| ------------------------ | ---------------- | ----------- | ------------- | -------------- |
| BioMedGPT-LM-7B | 7 | Fine-tuing | 51.4 | 76.1 |
Out-of-scope Uses
Technical Report
"BioMedGPT: Open Multimodal Generative Pre-trained Transformer for BioMedicine"
github
https://github.com/BioFM/OpenBioMed
Limitations
Large-scale generative language models represent a novel technology, with their generated outputs determined by probabilities, possibly resulting in unforeseen issues, such as generating responses that may contain elements of danger, bias, discrimination, or other harmful content. Up to this point, our experiments focus on data within the field of English biomedical domains, leaving many scenarios unaddressed. Therefore, before using BioMedGPT, developers should conduct safety testing and necessary adjustments. While BioMedGPT has expertise in areas like biomedicine and chemistry, it should not be employed for research that is hazardous or could endanger human life, and it cannot replace medical professionals or provide professional treatment advice. Users need to be cautious and take extra care when using these models.
