Instructions to use microsoft/BioGPT-Large-PubMedQA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/BioGPT-Large-PubMedQA with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="microsoft/BioGPT-Large-PubMedQA")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("microsoft/BioGPT-Large-PubMedQA") model = AutoModelForCausalLM.from_pretrained("microsoft/BioGPT-Large-PubMedQA") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use microsoft/BioGPT-Large-PubMedQA with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "microsoft/BioGPT-Large-PubMedQA" # 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-Large-PubMedQA", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/microsoft/BioGPT-Large-PubMedQA
- SGLang
How to use microsoft/BioGPT-Large-PubMedQA 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-Large-PubMedQA" \ --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-Large-PubMedQA", "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-Large-PubMedQA" \ --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-Large-PubMedQA", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use microsoft/BioGPT-Large-PubMedQA with Docker Model Runner:
docker model run hf.co/microsoft/BioGPT-Large-PubMedQA
Error on installation on endpoints. Does anyone know how to solve it?
Server message:Endpoint failed to start. on, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 732, in lifespan async with self.lifespan_context(app) as maybe_state: File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 608, in aenter await self.router.startup() File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 709, in startup await handler() File "/app/webservice_starlette.py", line 60, in some_startup_task inference_handler = get_inference_handler_either_custom_or_default_handler(HF_MODEL_DIR, task=HF_TASK) File "/app/huggingface_inference_toolkit/handler.py", line 54, in get_inference_handler_either_custom_or_default_handler return HuggingFaceHandler(model_dir=model_dir, task=task) File "/app/huggingface_inference_toolkit/handler.py", line 18, in init self.pipeline = get_pipeline( File "/app/huggingface_inference_toolkit/utils.py", line 276, in get_pipeline hf******** = pipeline( File "/usr/local/lib/python3.10/dist-packages/transformers/pipelines/init.py", line 1004, in pipeline tokenizer = AutoTokenizer.from_pretrained( File "/usr/local/lib/python3.10/dist-packages/transformers/models/auto/tokenization_auto.py", line 846, in from_pretrained return tokenizer_class_py.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs) File "/usr/local/lib/python3.10/dist-packages/transformers/tokenization_utils_base.py", line 2048, in from_pretrained return cls._from_pretrained( File "/usr/local/lib/python3.10/dist-packages/transformers/tokenization_utils_base.py", line 2287, in _from_pretrained tokenizer = cls(*init_inputs, **init_kwargs) File "/usr/local/lib/python3.10/dist-packages/transformers/models/biogpt/tokenization_biogpt.py", line 118, in init raise ImportError( ImportError: You need to install sacremoses to use BioGptTokenizer. See https://pypi.org/project/sacremoses/ for installation. Application startup failed. Exiting.