Setup requirements for running Granite Switch tutorials.
| Tutorial Type | GPU Required |
|---|---|
| Quickstart (micro model) | Yes (CUDA) |
| HuggingFace Scripts (3B) | Yes (CUDA) |
| vLLM/Mellea (8B) | Yes (CUDA) |
| Large Models (30B) | Yes (CUDA) |
Python 3.10+ is required.
pip install granite-switchFor direct model inference with HuggingFace Transformers:
pip install "granite-switch[hf,compose]"This includes:
transformersfor model loading and generationtorchwith CUDA supportpeftfor LoRA operations- Compose tools for model building
For production inference with vLLM:
pip install "granite-switch[vllm]"This includes:
vllm>=0.19.1for high-performance inference- Tensor parallelism support for multi-GPU setups
Mellea provides high-level wrapper functions for adapter invocation:
pip install melleaFor running Jupyter notebooks:
pip install jupyter chromadb tqdm httpx python-dotenvAvailable on HuggingFace Hub:
| Model | Size | Use Case |
|---|---|---|
ibm-granite/granite-4.0-micro |
3B | Quick demos, testing |
ibm-granite/granite-4.1-3b |
3B | Development, single GPU |
ibm-granite/granite-4.1-8b |
8B | Production, single GPU |
ibm-granite/granite-4.1-30b |
30B | Production, multi-GPU |
Official IBM Granite adapter libraries (r1.0):
| Library | Adapters | Purpose |
|---|---|---|
| ibm-granite/granitelib-rag-r1.0 | 5 | RAG adapters (rewrite, answerability, citations, etc.) |
| ibm-granite/granitelib-core-r1.0 | 3 | Core adapters (certainty, requirements, attributions) |
| ibm-granite/granitelib-guardian-r1.0 | 4 | Guardian adapters (harm check, policy, factuality, etc.) |
For accessing gated models:
# Interactive login
huggingface-cli login
# Or set token directly
export HF_TOKEN=your_token_hereFor tutorials using Mellea or the vLLM backend:
# Single GPU
python -m vllm.entrypoints.openai.api_server \
--model <path-or-hf-repo> \
--port 8000 \
--host 0.0.0.0
# Multi-GPU (tensor parallelism)
python -m vllm.entrypoints.openai.api_server \
--model <path-or-hf-repo> \
--port 8000 \
--host 0.0.0.0 \
--tensor-parallel-size 2Verify the server is running:
curl http://localhost:8000/v1/models| Resource | URL | Description |
|---|---|---|
| Mellea | https://github.com/generative-computing/mellea | Framework for adapter invocation |
| Granite Models | https://huggingface.co/ibm-granite | Official IBM Granite models |
| Granite Libraries | https://huggingface.co/collections/ibm-granite/granite-libraries | Adapter libraries collection |
| vLLM Docs | https://docs.vllm.ai/ | vLLM documentation |
Once prerequisites are installed, proceed to:
- Hello Mellea - Mellea adapters with vLLM (recommended start)
- Hello Adapter - Minimal HuggingFace example
- Learning Paths - Choose your path based on use case