Instructions to use stanford-crfm/BioMedLM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use stanford-crfm/BioMedLM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="stanford-crfm/BioMedLM")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("stanford-crfm/BioMedLM") model = AutoModelForCausalLM.from_pretrained("stanford-crfm/BioMedLM") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use stanford-crfm/BioMedLM with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "stanford-crfm/BioMedLM" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "stanford-crfm/BioMedLM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/stanford-crfm/BioMedLM
- SGLang
How to use stanford-crfm/BioMedLM 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 "stanford-crfm/BioMedLM" \ --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": "stanford-crfm/BioMedLM", "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 "stanford-crfm/BioMedLM" \ --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": "stanford-crfm/BioMedLM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use stanford-crfm/BioMedLM with Docker Model Runner:
docker model run hf.co/stanford-crfm/BioMedLM
Availability of BioMedLM: Model not loading
Were you able to get it to work? Still struggling with the same issue.
model's still there. It's never really worked well with HF's hosted inference stuff. I think it's slightly too big?
I tried the hosted inference API too and got the following errors:
Validation Error:
The initial part of the error message is aHFValidationErrorthrown by thehuggingface_hublibrary. This indicates that the repository ID (which is the model ID) does not adhere to the required validation rules. Specifically, it says:Repo id must use alphanumeric chars or '-', '_', '.', '--' and '..' are forbidden, '-' and '.' cannot start or end the name, max length is 96: '/repository'.This suggests that the repository ID should only contain alphanumeric characters, and certain symbols like
-,_, and.are allowed if they do not start or end the name. Also, the maximum length of 96 characters should not be exceeded. The provided value'/repository'does not meet these criteria.Missing Config File:
Next, the logs sayValueError: Can't find 'adapter_config.json' at '/repository'. This indicates that the expectedadapter_config.jsonfile is not found at the given path. The path'/repository'seems to be incorrect or not the actual location of the config file.
