Instructions to use unsloth/gemma-3n-E2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use unsloth/gemma-3n-E2B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="unsloth/gemma-3n-E2B")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("unsloth/gemma-3n-E2B") model = AutoModelForMultimodalLM.from_pretrained("unsloth/gemma-3n-E2B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use unsloth/gemma-3n-E2B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "unsloth/gemma-3n-E2B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "unsloth/gemma-3n-E2B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/unsloth/gemma-3n-E2B
- SGLang
How to use unsloth/gemma-3n-E2B 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 "unsloth/gemma-3n-E2B" \ --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": "unsloth/gemma-3n-E2B", "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 "unsloth/gemma-3n-E2B" \ --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": "unsloth/gemma-3n-E2B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Unsloth Desktop
- Docker Model Runner
How to use unsloth/gemma-3n-E2B with Docker Model Runner:
docker model run hf.co/unsloth/gemma-3n-E2B
Download preprocessor_config.json from unsloth/gemma-3n-E2B: direct link, hf CLI and curl.
- Browser
- Download file 1.09 kB
-
https://huggingface.co/unsloth/gemma-3n-E2B/resolve/main/preprocessor_config.json
- Command line
-
hf download hf://unsloth/gemma-3n-E2B/preprocessor_config.json
-
curl -L -o preprocessor_config.json https://huggingface.co/unsloth/gemma-3n-E2B/resolve/main/preprocessor_config.json
1.09 kB
| { | |
| "crop_size": null, | |
| "data_format": "channels_first", | |
| "default_to_square": false, | |
| "device": null, | |
| "disable_grouping": null, | |
| "dither": 0.0, | |
| "do_center_crop": null, | |
| "do_convert_rgb": null, | |
| "do_normalize": false, | |
| "do_rescale": true, | |
| "do_resize": true, | |
| "feature_size": 128, | |
| "fft_length": 1024, | |
| "fft_overdrive": true, | |
| "frame_length": 512, | |
| "hop_length": 160, | |
| "image_mean": [ | |
| 0.5, | |
| 0.5, | |
| 0.5 | |
| ], | |
| "image_processor_type": "SiglipImageProcessorFast", | |
| "image_seq_length": 256, | |
| "image_std": [ | |
| 0.5, | |
| 0.5, | |
| 0.5 | |
| ], | |
| "input_data_format": null, | |
| "input_scale_factor": 1.0, | |
| "max_frequency": 7600.0, | |
| "mel_floor": 1e-05, | |
| "min_frequency": 125.0, | |
| "padding_side": "left", | |
| "padding_value": 0.0, | |
| "per_bin_mean": null, | |
| "per_bin_stddev": null, | |
| "preemphasis": 0.97, | |
| "preemphasis_htk_flavor": true, | |
| "processor_class": "Gemma3nProcessor", | |
| "resample": 2, | |
| "rescale_factor": 0.00392156862745098, | |
| "return_attention_mask": true, | |
| "return_tensors": null, | |
| "sampling_rate": 16000, | |
| "size": { | |
| "height": 768, | |
| "width": 768 | |
| } | |
| } | |