Image-Text-to-Text
Transformers
Safetensors
English
gemma3
unsloth
gemma
google
text-generation-inference
Instructions to use unsloth/gemma-3-12b-pt with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use unsloth/gemma-3-12b-pt with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="unsloth/gemma-3-12b-pt")# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("unsloth/gemma-3-12b-pt") model = AutoModelForImageTextToText.from_pretrained("unsloth/gemma-3-12b-pt") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use unsloth/gemma-3-12b-pt with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "unsloth/gemma-3-12b-pt" # 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-3-12b-pt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/unsloth/gemma-3-12b-pt
- SGLang
How to use unsloth/gemma-3-12b-pt 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-12b-pt" \ --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-3-12b-pt", "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-3-12b-pt" \ --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-3-12b-pt", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Unsloth Studio new
How to use unsloth/gemma-3-12b-pt with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for unsloth/gemma-3-12b-pt to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for unsloth/gemma-3-12b-pt to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for unsloth/gemma-3-12b-pt to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="unsloth/gemma-3-12b-pt", max_seq_length=2048, ) - Docker Model Runner
How to use unsloth/gemma-3-12b-pt with Docker Model Runner:
docker model run hf.co/unsloth/gemma-3-12b-pt
Add files using upload-large-folder tool
Browse files- config.json +27 -1
- model-00001-of-00012.safetensors +3 -0
- model-00002-of-00012.safetensors +3 -0
- model-00003-of-00012.safetensors +3 -0
- model-00004-of-00012.safetensors +3 -0
- model-00005-of-00012.safetensors +3 -0
- model-00006-of-00012.safetensors +3 -0
- model-00007-of-00012.safetensors +3 -0
- model-00008-of-00012.safetensors +3 -0
- model-00009-of-00012.safetensors +3 -0
- model-00010-of-00012.safetensors +3 -0
- model-00011-of-00012.safetensors +3 -0
- model-00012-of-00012.safetensors +3 -0
- tokenizer.json +2 -2
- tokenizer_config.json +4 -3
config.json
CHANGED
|
@@ -3,34 +3,60 @@
|
|
| 3 |
"Gemma3ForConditionalGeneration"
|
| 4 |
],
|
| 5 |
"boi_token_index": 255999,
|
|
|
|
| 6 |
"eoi_token_index": 256000,
|
|
|
|
| 7 |
"image_token_index": 262144,
|
| 8 |
"initializer_range": 0.02,
|
| 9 |
"mm_tokens_per_image": 256,
|
| 10 |
"model_type": "gemma3",
|
|
|
|
| 11 |
"text_config": {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
"hidden_size": 3840,
|
|
|
|
| 13 |
"intermediate_size": 15360,
|
|
|
|
| 14 |
"model_type": "gemma3_text",
|
| 15 |
"num_attention_heads": 16,
|
| 16 |
"num_hidden_layers": 48,
|
| 17 |
"num_key_value_heads": 8,
|
|
|
|
|
|
|
|
|
|
| 18 |
"rope_scaling": {
|
| 19 |
"factor": 8.0,
|
| 20 |
"rope_type": "linear"
|
| 21 |
},
|
| 22 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
},
|
| 24 |
"torch_dtype": "bfloat16",
|
| 25 |
"transformers_version": "4.50.0.dev0",
|
|
|
|
| 26 |
"vision_config": {
|
|
|
|
|
|
|
| 27 |
"hidden_size": 1152,
|
| 28 |
"image_size": 896,
|
| 29 |
"intermediate_size": 4304,
|
|
|
|
| 30 |
"model_type": "siglip_vision_model",
|
| 31 |
"num_attention_heads": 16,
|
|
|
|
| 32 |
"num_hidden_layers": 27,
|
| 33 |
"patch_size": 14,
|
|
|
|
| 34 |
"vision_use_head": false
|
| 35 |
}
|
| 36 |
}
|
|
|
|
| 3 |
"Gemma3ForConditionalGeneration"
|
| 4 |
],
|
| 5 |
"boi_token_index": 255999,
|
| 6 |
+
"bos_token_id": 2,
|
| 7 |
"eoi_token_index": 256000,
|
| 8 |
+
"eos_token_id": 1,
|
| 9 |
"image_token_index": 262144,
|
| 10 |
"initializer_range": 0.02,
|
| 11 |
"mm_tokens_per_image": 256,
|
| 12 |
"model_type": "gemma3",
|
| 13 |
+
"pad_token_id": 0,
|
| 14 |
"text_config": {
|
| 15 |
+
"attention_bias": false,
|
| 16 |
+
"attention_dropout": 0.0,
|
| 17 |
+
"attn_logit_softcapping": null,
|
| 18 |
+
"cache_implementation": "hybrid",
|
| 19 |
+
"final_logit_softcapping": null,
|
| 20 |
+
"head_dim": 256,
|
| 21 |
+
"hidden_activation": "gelu_pytorch_tanh",
|
| 22 |
"hidden_size": 3840,
|
| 23 |
+
"initializer_range": 0.02,
|
| 24 |
"intermediate_size": 15360,
|
| 25 |
+
"max_position_embeddings": 131072,
|
| 26 |
"model_type": "gemma3_text",
|
| 27 |
"num_attention_heads": 16,
|
| 28 |
"num_hidden_layers": 48,
|
| 29 |
"num_key_value_heads": 8,
|
| 30 |
+
"query_pre_attn_scalar": 256,
|
| 31 |
+
"rms_norm_eps": 1e-06,
|
| 32 |
+
"rope_local_base_freq": 10000.0,
|
| 33 |
"rope_scaling": {
|
| 34 |
"factor": 8.0,
|
| 35 |
"rope_type": "linear"
|
| 36 |
},
|
| 37 |
+
"rope_theta": 1000000.0,
|
| 38 |
+
"sliding_window": 1024,
|
| 39 |
+
"sliding_window_pattern": 6,
|
| 40 |
+
"torch_dtype": "bfloat16",
|
| 41 |
+
"use_cache": true,
|
| 42 |
+
"vocab_size": 262208
|
| 43 |
},
|
| 44 |
"torch_dtype": "bfloat16",
|
| 45 |
"transformers_version": "4.50.0.dev0",
|
| 46 |
+
"unsloth_fixed": true,
|
| 47 |
"vision_config": {
|
| 48 |
+
"attention_dropout": 0.0,
|
| 49 |
+
"hidden_act": "gelu_pytorch_tanh",
|
| 50 |
"hidden_size": 1152,
|
| 51 |
"image_size": 896,
|
| 52 |
"intermediate_size": 4304,
|
| 53 |
+
"layer_norm_eps": 1e-06,
|
| 54 |
"model_type": "siglip_vision_model",
|
| 55 |
"num_attention_heads": 16,
|
| 56 |
+
"num_channels": 3,
|
| 57 |
"num_hidden_layers": 27,
|
| 58 |
"patch_size": 14,
|
| 59 |
+
"torch_dtype": "bfloat16",
|
| 60 |
"vision_use_head": false
|
| 61 |
}
|
| 62 |
}
|
model-00001-of-00012.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fbd8138d46f6f44099c4c2488cd02d738ce82af8d69e076f905d1ad8e2e228ca
|
| 3 |
+
size 4854573696
|
model-00002-of-00012.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:29600e3a1728c64296d8c2b3ac55e4fd3c6249945c193cb3c7b6bf0aaf950247
|
| 3 |
+
size 4954792944
|
model-00003-of-00012.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b09ea9e6e912eac394556344ba3556c4e017ee12bf7e1b8b4ec188df6f9aab51
|
| 3 |
+
size 4954792976
|
model-00004-of-00012.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0c43345912a6c260139439e2a1a0fea0d5114dd2f59bfe1a4afa385fc12e4b78
|
| 3 |
+
size 4954793016
|
model-00005-of-00012.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:af9a5b18c3b725c0221df2f09371a43d9096becf001a41efdcb375954d2dab2c
|
| 3 |
+
size 4954793016
|
model-00006-of-00012.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c6aa813f8991ca2eee99955a764c153ed56f22863b6d898a994a0b125d5bab99
|
| 3 |
+
size 4954793016
|
model-00007-of-00012.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d2c627c3bf8d3641bb3f40165d2a27d834230cedfab836f5a2f954e4e2b20f91
|
| 3 |
+
size 4954793016
|
model-00008-of-00012.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1de6ab69b4e17bb54b1536a9e6b593a7d3e927d31cf1c75dfff82ac71fb9f96e
|
| 3 |
+
size 4954793016
|
model-00009-of-00012.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ca653bc91f1d4df924640386011789be43e5e95a3480e6adbb5028da85b2f8ea
|
| 3 |
+
size 4954793016
|
model-00010-of-00012.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7356b01d5ecddeb58c33e6750df65552eb916600cfd5e24002cd72e90ceae42e
|
| 3 |
+
size 4954793016
|
model-00011-of-00012.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:75568b29ce3aa9e231e1ac3b37ef64d9eb174da991d9709764b678b462a37e83
|
| 3 |
+
size 4954793016
|
model-00012-of-00012.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:51df12abc8e4d4e46fb855ef561c96be40427234a307a1f523f9eb8db173ab34
|
| 3 |
+
size 462476696
|
tokenizer.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4667f2089529e8e7657cfb6d1c19910ae71ff5f28aa7ab2ff2763330affad795
|
| 3 |
+
size 33384568
|
tokenizer_config.json
CHANGED
|
@@ -2160,7 +2160,7 @@
|
|
| 2160 |
"normalized": false,
|
| 2161 |
"rstrip": false,
|
| 2162 |
"single_word": false,
|
| 2163 |
-
"special":
|
| 2164 |
},
|
| 2165 |
"256000": {
|
| 2166 |
"content": "<end_of_image>",
|
|
@@ -2168,7 +2168,7 @@
|
|
| 2168 |
"normalized": false,
|
| 2169 |
"rstrip": false,
|
| 2170 |
"single_word": false,
|
| 2171 |
-
"special":
|
| 2172 |
},
|
| 2173 |
"256001": {
|
| 2174 |
"content": "<unused99>",
|
|
@@ -51334,8 +51334,9 @@
|
|
| 51334 |
"image_token": "<image_soft_token>"
|
| 51335 |
},
|
| 51336 |
"image_token": "<image_soft_token>",
|
| 51337 |
-
"model_max_length":
|
| 51338 |
"pad_token": "<pad>",
|
|
|
|
| 51339 |
"processor_class": "Gemma3Processor",
|
| 51340 |
"sp_model_kwargs": null,
|
| 51341 |
"spaces_between_special_tokens": false,
|
|
|
|
| 2160 |
"normalized": false,
|
| 2161 |
"rstrip": false,
|
| 2162 |
"single_word": false,
|
| 2163 |
+
"special": true
|
| 2164 |
},
|
| 2165 |
"256000": {
|
| 2166 |
"content": "<end_of_image>",
|
|
|
|
| 2168 |
"normalized": false,
|
| 2169 |
"rstrip": false,
|
| 2170 |
"single_word": false,
|
| 2171 |
+
"special": true
|
| 2172 |
},
|
| 2173 |
"256001": {
|
| 2174 |
"content": "<unused99>",
|
|
|
|
| 51334 |
"image_token": "<image_soft_token>"
|
| 51335 |
},
|
| 51336 |
"image_token": "<image_soft_token>",
|
| 51337 |
+
"model_max_length": 131072,
|
| 51338 |
"pad_token": "<pad>",
|
| 51339 |
+
"padding_side": "left",
|
| 51340 |
"processor_class": "Gemma3Processor",
|
| 51341 |
"sp_model_kwargs": null,
|
| 51342 |
"spaces_between_special_tokens": false,
|