Instructions to use toxzak/gemma4-e2b-exp-quant with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use toxzak/gemma4-e2b-exp-quant with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="toxzak/gemma4-e2b-exp-quant")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("toxzak/gemma4-e2b-exp-quant", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use toxzak/gemma4-e2b-exp-quant with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "toxzak/gemma4-e2b-exp-quant" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "toxzak/gemma4-e2b-exp-quant", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/toxzak/gemma4-e2b-exp-quant
- SGLang
How to use toxzak/gemma4-e2b-exp-quant 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 "toxzak/gemma4-e2b-exp-quant" \ --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": "toxzak/gemma4-e2b-exp-quant", "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 "toxzak/gemma4-e2b-exp-quant" \ --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": "toxzak/gemma4-e2b-exp-quant", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use toxzak/gemma4-e2b-exp-quant with Docker Model Runner:
docker model run hf.co/toxzak/gemma4-e2b-exp-quant
| import torch | |
| from typing import Dict, Optional, List | |
| from .Sub1BitLLM import Sub1BitLLM, Sub1BitConfig, from_fp16 | |
| from .lowrank_factorization import low_rank_factorize, factorize_model_weights, compute_optimal_rank | |
| from .quantization import ( | |
| ternary_quantize, ternary_pack, ternary_unpack, | |
| sigma_quantize, sigma_dequantize, | |
| quantize_factor, pack_factor, unpack_factor, dequantize_factor, | |
| ) | |
| from .groupwise_int4 import ( | |
| dequantize_groupwise_int4, | |
| estimate_groupwise_int4_bpw, | |
| pack_signed_int4, | |
| quantize_groupwise_int4, | |
| unpack_signed_int4, | |
| ) | |
| from .mixed_budget import allocate_mixed_budget, summarize_allocation | |
| from .error_budget_residual import ( | |
| dequantize_binary_residual, | |
| dequantize_error_budget_residual, | |
| estimate_binary_residual_bpw, | |
| estimate_error_budget_residual_bpw, | |
| quantize_binary_residual, | |
| quantize_error_budget_residual, | |
| ) | |
| from .gguf_writer import GGUFWriter, GGML_TYPES, GGUF_TYPES | |
| from .pack_gguf import pack_sub1bit_model, QuantizedLayer | |
| __all__ = [ | |
| "Sub1BitLLM", | |
| "Sub1BitConfig", | |
| "from_fp16", | |
| "low_rank_factorize", | |
| "factorize_model_weights", | |
| "compute_optimal_rank", | |
| "ternary_quantize", | |
| "ternary_pack", | |
| "ternary_unpack", | |
| "sigma_quantize", | |
| "sigma_dequantize", | |
| "quantize_factor", | |
| "pack_factor", | |
| "unpack_factor", | |
| "dequantize_factor", | |
| "dequantize_groupwise_int4", | |
| "estimate_groupwise_int4_bpw", | |
| "pack_signed_int4", | |
| "quantize_groupwise_int4", | |
| "unpack_signed_int4", | |
| "allocate_mixed_budget", | |
| "summarize_allocation", | |
| "dequantize_binary_residual", | |
| "dequantize_error_budget_residual", | |
| "estimate_binary_residual_bpw", | |
| "estimate_error_budget_residual_bpw", | |
| "quantize_binary_residual", | |
| "quantize_error_budget_residual", | |
| "GGUFWriter", | |
| "GGML_TYPES", | |
| "GGUF_TYPES", | |
| "pack_sub1bit_model", | |
| "QuantizedLayer", | |
| ] | |