Image-Text-to-Text
Transformers
Safetensors
English
gemma3
unsloth
gemma
google
conversational
text-generation-inference
4-bit precision
bitsandbytes
Instructions to use unsloth/gemma-3-27b-it-unsloth-bnb-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use unsloth/gemma-3-27b-it-unsloth-bnb-4bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="unsloth/gemma-3-27b-it-unsloth-bnb-4bit") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("unsloth/gemma-3-27b-it-unsloth-bnb-4bit") model = AutoModelForMultimodalLM.from_pretrained("unsloth/gemma-3-27b-it-unsloth-bnb-4bit", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use unsloth/gemma-3-27b-it-unsloth-bnb-4bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "unsloth/gemma-3-27b-it-unsloth-bnb-4bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "unsloth/gemma-3-27b-it-unsloth-bnb-4bit", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/unsloth/gemma-3-27b-it-unsloth-bnb-4bit
- SGLang
How to use unsloth/gemma-3-27b-it-unsloth-bnb-4bit 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-3-27b-it-unsloth-bnb-4bit" \ --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": "unsloth/gemma-3-27b-it-unsloth-bnb-4bit", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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-3-27b-it-unsloth-bnb-4bit" \ --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": "unsloth/gemma-3-27b-it-unsloth-bnb-4bit", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Unsloth Desktop
- Docker Model Runner
How to use unsloth/gemma-3-27b-it-unsloth-bnb-4bit with Docker Model Runner:
docker model run hf.co/unsloth/gemma-3-27b-it-unsloth-bnb-4bit
Add files using upload-large-folder tool
Browse files
config.json
CHANGED
|
@@ -25,6 +25,8 @@
|
|
| 25 |
"multi_modal_projector",
|
| 26 |
"merger",
|
| 27 |
"modality_projection",
|
|
|
|
|
|
|
| 28 |
"language_model.model.layers.10.mlp",
|
| 29 |
"language_model.model.layers.22.self_attn",
|
| 30 |
"language_model.model.layers.11.mlp",
|
|
|
|
| 25 |
"multi_modal_projector",
|
| 26 |
"merger",
|
| 27 |
"modality_projection",
|
| 28 |
+
"language_model.model.layers.12.mlp",
|
| 29 |
+
"language_model.model.layers.9.mlp",
|
| 30 |
"language_model.model.layers.10.mlp",
|
| 31 |
"language_model.model.layers.22.self_attn",
|
| 32 |
"language_model.model.layers.11.mlp",
|
model-00001-of-00005.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cbaa109f7ddc56f24322f9b241ce14563d158601166b5fef0c2ec1c26f7de8f2
|
| 3 |
+
size 4977824200
|
model-00002-of-00005.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d572c5c1d096a6827adaf5de00d561ed38c5626a7701ca5d9d33a7aec6e1765e
|
| 3 |
+
size 4864824358
|
model-00003-of-00005.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ba55a5216d5a160834c97eebc06043d32f8142bd8f84c1a2203589568a103e0d
|
| 3 |
+
size 4985666158
|
model-00004-of-00005.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ff3d94bfc64db912d1eb580efdce9b9cad05d5aa5ca0b0ab3a1f56ed3117f001
|
| 3 |
+
size 4959770330
|
model-00005-of-00005.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:27f9084745e9d4e62d5a8360aa2b99d874fd0f25ccb2d7dc1d60fd53556377db
|
| 3 |
+
size 272742837
|
model.safetensors.index.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|