Text Generation
Transformers
Safetensors
sarvam
nvfp4
quantized
modelopt
tensorrt-llm
dgx-spark
8-bit precision
Instructions to use Sanyam0605/sarvam-1-NVFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Sanyam0605/sarvam-1-NVFP4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Sanyam0605/sarvam-1-NVFP4")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Sanyam0605/sarvam-1-NVFP4", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Sanyam0605/sarvam-1-NVFP4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Sanyam0605/sarvam-1-NVFP4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Sanyam0605/sarvam-1-NVFP4", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Sanyam0605/sarvam-1-NVFP4
- SGLang
How to use Sanyam0605/sarvam-1-NVFP4 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 "Sanyam0605/sarvam-1-NVFP4" \ --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": "Sanyam0605/sarvam-1-NVFP4", "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 "Sanyam0605/sarvam-1-NVFP4" \ --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": "Sanyam0605/sarvam-1-NVFP4", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Sanyam0605/sarvam-1-NVFP4 with Docker Model Runner:
docker model run hf.co/Sanyam0605/sarvam-1-NVFP4
Sanyam0605/sarvam-1-NVFP4
NVFP4-quantized version of sarvamai/sarvam-1, quantized using NVIDIA TensorRT Model Optimizer (modelopt 0.35.0).
Quantization Details
| Parameter | Value |
|---|---|
| Base Model | sarvamai/sarvam-1 |
| Architecture | LlamaForCausalLM |
| Quantization | NVFP4 (4-bit floating point) |
| KV Cache | FP8 |
| Group Size | 16 |
| Hidden Size | 2048 |
| Layers | 28 |
| Attention Heads | 16 (KV: 8) |
| Context Length | 8192 |
| Vocab Size | 68096 |
| Quantizer | modelopt v0.35.0 |
| Excluded Modules | lm_head |
Usage
With TensorRT-LLM (recommended)
from tensorrt_llm import LLM, SamplingParams
llm = LLM(model="Sanyam0605/sarvam-1-NVFP4")
output = llm.generate(["Hello, tell me about"], sampling_params=SamplingParams(max_tokens=128))
print(output[0].outputs[0].text)
With TensorRT-LLM CLI
# Using the NVIDIA DGX Spark container
docker run --rm --gpus all \
-v $HOME/.cache/huggingface:/root/.cache/huggingface \
nvcr.io/nvidia/tensorrt-llm/release:spark-single-gpu-dev \
python -c "
from tensorrt_llm import LLM, SamplingParams
llm = LLM(model='Sanyam0605/sarvam-1-NVFP4')
out = llm.generate(['Translate to Hindi: Good morning'], sampling_params=SamplingParams(max_tokens=64))
print(out[0].outputs[0].text)
"
Loading with HuggingFace Transformers
Note: NVFP4 quantization requires TensorRT-LLM for inference. Standard
transformersloading is not supported for this quantization format.
Hardware Requirements
- Recommended: NVIDIA DGX Spark (GB10, 128GB UMA) or any GPU with FP4 support (Blackwell architecture)
- CUDA Compute Capability: 12.0+
About Sarvam-1
Sarvam-1 is a multilingual language model with strong performance across Indian languages. This quantized version reduces memory footprint while maintaining quality, making it suitable for deployment on edge devices like the DGX Spark.
Acknowledgments
- Base model by Sarvam AI
- Quantization using NVIDIA ModelOpt
- Downloads last month
- 2
Model tree for Sanyam0605/sarvam-1-NVFP4
Base model
sarvamai/sarvam-1