Instructions to use nvidia/Hymba-1.5B-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nvidia/Hymba-1.5B-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nvidia/Hymba-1.5B-Base", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("nvidia/Hymba-1.5B-Base", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use nvidia/Hymba-1.5B-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nvidia/Hymba-1.5B-Base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nvidia/Hymba-1.5B-Base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/nvidia/Hymba-1.5B-Base
- SGLang
How to use nvidia/Hymba-1.5B-Base 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 "nvidia/Hymba-1.5B-Base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nvidia/Hymba-1.5B-Base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "nvidia/Hymba-1.5B-Base" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nvidia/Hymba-1.5B-Base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use nvidia/Hymba-1.5B-Base with Docker Model Runner:
docker model run hf.co/nvidia/Hymba-1.5B-Base
Xin Dong commited on
Commit ·
a98fb88
1
Parent(s): 3d41055
update setup
Browse files
setup.sh
CHANGED
|
@@ -9,6 +9,8 @@ if [[ "$cuda_version" != "12.1" && "$cuda_version" != "12.4" ]]; then
|
|
| 9 |
exit 1
|
| 10 |
fi
|
| 11 |
|
|
|
|
|
|
|
| 12 |
# Install PyTorch with the specified CUDA version
|
| 13 |
conda install pytorch==2.5.0 torchvision==0.20.0 torchaudio==2.5.0 pytorch-cuda=$cuda_version -c pytorch -c nvidia
|
| 14 |
|
|
@@ -28,7 +30,7 @@ cd ..
|
|
| 28 |
# Clone and install causal-conv1d with specified CUDA version
|
| 29 |
git clone https://github.com/Dao-AILab/causal-conv1d.git
|
| 30 |
cd causal-conv1d
|
| 31 |
-
|
| 32 |
TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6;8.9;9.0" python setup.py install
|
| 33 |
cd ..
|
| 34 |
|
|
|
|
| 9 |
exit 1
|
| 10 |
fi
|
| 11 |
|
| 12 |
+
export CUDA_HOME=/usr/local/cuda-$cuda_version
|
| 13 |
+
|
| 14 |
# Install PyTorch with the specified CUDA version
|
| 15 |
conda install pytorch==2.5.0 torchvision==0.20.0 torchaudio==2.5.0 pytorch-cuda=$cuda_version -c pytorch -c nvidia
|
| 16 |
|
|
|
|
| 30 |
# Clone and install causal-conv1d with specified CUDA version
|
| 31 |
git clone https://github.com/Dao-AILab/causal-conv1d.git
|
| 32 |
cd causal-conv1d
|
| 33 |
+
|
| 34 |
TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6;8.9;9.0" python setup.py install
|
| 35 |
cd ..
|
| 36 |
|