Image-Text-to-Text
Transformers
Safetensors
GGUF
English
gemma3
text-generation-inference
unsloth
conversational
Instructions to use helviz/gemma-3-4b-it-finetune with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use helviz/gemma-3-4b-it-finetune with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="helviz/gemma-3-4b-it-finetune") 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("helviz/gemma-3-4b-it-finetune") model = AutoModelForMultimodalLM.from_pretrained("helviz/gemma-3-4b-it-finetune") 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]:])) - llama-cpp-python
How to use helviz/gemma-3-4b-it-finetune with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="helviz/gemma-3-4b-it-finetune", filename="gemma-3-4b-it-finetune.Q4_K_M.gguf", )
llm.create_chat_completion( 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" } } ] } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use helviz/gemma-3-4b-it-finetune with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf helviz/gemma-3-4b-it-finetune:Q4_K_M # Run inference directly in the terminal: llama cli -hf helviz/gemma-3-4b-it-finetune:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf helviz/gemma-3-4b-it-finetune:Q4_K_M # Run inference directly in the terminal: llama cli -hf helviz/gemma-3-4b-it-finetune:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf helviz/gemma-3-4b-it-finetune:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf helviz/gemma-3-4b-it-finetune:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf helviz/gemma-3-4b-it-finetune:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf helviz/gemma-3-4b-it-finetune:Q4_K_M
Use Docker
docker model run hf.co/helviz/gemma-3-4b-it-finetune:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use helviz/gemma-3-4b-it-finetune with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "helviz/gemma-3-4b-it-finetune" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "helviz/gemma-3-4b-it-finetune", "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/helviz/gemma-3-4b-it-finetune:Q4_K_M
- SGLang
How to use helviz/gemma-3-4b-it-finetune 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 "helviz/gemma-3-4b-it-finetune" \ --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": "helviz/gemma-3-4b-it-finetune", "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 "helviz/gemma-3-4b-it-finetune" \ --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": "helviz/gemma-3-4b-it-finetune", "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" } } ] } ] }' - Ollama
How to use helviz/gemma-3-4b-it-finetune with Ollama:
ollama run hf.co/helviz/gemma-3-4b-it-finetune:Q4_K_M
- Unsloth Studio
How to use helviz/gemma-3-4b-it-finetune 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 helviz/gemma-3-4b-it-finetune 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 helviz/gemma-3-4b-it-finetune to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for helviz/gemma-3-4b-it-finetune to start chatting
- Atomic Chat new
- Docker Model Runner
How to use helviz/gemma-3-4b-it-finetune with Docker Model Runner:
docker model run hf.co/helviz/gemma-3-4b-it-finetune:Q4_K_M
- Lemonade
How to use helviz/gemma-3-4b-it-finetune with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull helviz/gemma-3-4b-it-finetune:Q4_K_M
Run and chat with the model
lemonade run user.gemma-3-4b-it-finetune-Q4_K_M
List all available models
lemonade list
(Trained with Unsloth)
Browse files- .gitattributes +1 -0
- chat_template.jinja +8 -0
- config.json +112 -0
- generation_config.json +13 -0
- processor_config.json +28 -0
- tokenizer.json +3 -0
- tokenizer.model +3 -0
- tokenizer_config.json +0 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{{ bos_token }}{% if messages[0]['role'] == 'system' %}{{'<start_of_turn>user
|
| 2 |
+
' + messages[0]['content'] | trim + ' ' + messages[1]['content'] | trim + '<end_of_turn>
|
| 3 |
+
'}}{% set messages = messages[2:] %}{% endif %}{% for message in messages %}{% if message['role'] == 'user' %}{{'<start_of_turn>user
|
| 4 |
+
' + message['content'] | trim + '<end_of_turn>
|
| 5 |
+
'}}{% elif message['role'] == 'assistant' %}{{'<start_of_turn>model
|
| 6 |
+
' + message['content'] | trim + '<end_of_turn>
|
| 7 |
+
' }}{% else %}{{ raise_exception('Only user and assistant roles are supported!') }}{% endif %}{% endfor %}{% if add_generation_prompt %}{{ '<start_of_turn>model
|
| 8 |
+
' }}{% endif %}
|
config.json
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Gemma3ForConditionalGeneration"
|
| 4 |
+
],
|
| 5 |
+
"boi_token_index": 255999,
|
| 6 |
+
"bos_token_id": 2,
|
| 7 |
+
"torch_dtype": "float16",
|
| 8 |
+
"eoi_token_index": 256000,
|
| 9 |
+
"eos_token_id": 106,
|
| 10 |
+
"image_token_index": 262144,
|
| 11 |
+
"initializer_range": 0.02,
|
| 12 |
+
"mm_tokens_per_image": 256,
|
| 13 |
+
"model_name": "unsloth/gemma-3-4b-it-unsloth-bnb-4bit",
|
| 14 |
+
"model_type": "gemma3",
|
| 15 |
+
"pad_token_id": 0,
|
| 16 |
+
"text_config": {
|
| 17 |
+
"_sliding_window_pattern": 6,
|
| 18 |
+
"attention_bias": false,
|
| 19 |
+
"attention_dropout": 0.0,
|
| 20 |
+
"attn_logit_softcapping": null,
|
| 21 |
+
"bos_token_id": 2,
|
| 22 |
+
"cache_implementation": "hybrid",
|
| 23 |
+
"torch_dtype": "float16",
|
| 24 |
+
"eos_token_id": 1,
|
| 25 |
+
"final_logit_softcapping": null,
|
| 26 |
+
"head_dim": 256,
|
| 27 |
+
"hidden_activation": "gelu_pytorch_tanh",
|
| 28 |
+
"hidden_size": 2560,
|
| 29 |
+
"initializer_range": 0.02,
|
| 30 |
+
"intermediate_size": 10240,
|
| 31 |
+
"layer_types": [
|
| 32 |
+
"sliding_attention",
|
| 33 |
+
"sliding_attention",
|
| 34 |
+
"sliding_attention",
|
| 35 |
+
"sliding_attention",
|
| 36 |
+
"sliding_attention",
|
| 37 |
+
"full_attention",
|
| 38 |
+
"sliding_attention",
|
| 39 |
+
"sliding_attention",
|
| 40 |
+
"sliding_attention",
|
| 41 |
+
"sliding_attention",
|
| 42 |
+
"sliding_attention",
|
| 43 |
+
"full_attention",
|
| 44 |
+
"sliding_attention",
|
| 45 |
+
"sliding_attention",
|
| 46 |
+
"sliding_attention",
|
| 47 |
+
"sliding_attention",
|
| 48 |
+
"sliding_attention",
|
| 49 |
+
"full_attention",
|
| 50 |
+
"sliding_attention",
|
| 51 |
+
"sliding_attention",
|
| 52 |
+
"sliding_attention",
|
| 53 |
+
"sliding_attention",
|
| 54 |
+
"sliding_attention",
|
| 55 |
+
"full_attention",
|
| 56 |
+
"sliding_attention",
|
| 57 |
+
"sliding_attention",
|
| 58 |
+
"sliding_attention",
|
| 59 |
+
"sliding_attention",
|
| 60 |
+
"sliding_attention",
|
| 61 |
+
"full_attention",
|
| 62 |
+
"sliding_attention",
|
| 63 |
+
"sliding_attention",
|
| 64 |
+
"sliding_attention",
|
| 65 |
+
"sliding_attention"
|
| 66 |
+
],
|
| 67 |
+
"max_position_embeddings": 131072,
|
| 68 |
+
"model_type": "gemma3_text",
|
| 69 |
+
"num_attention_heads": 8,
|
| 70 |
+
"num_hidden_layers": 34,
|
| 71 |
+
"num_key_value_heads": 4,
|
| 72 |
+
"pad_token_id": 0,
|
| 73 |
+
"query_pre_attn_scalar": 256,
|
| 74 |
+
"rms_norm_eps": 1e-06,
|
| 75 |
+
"rope_parameters": {
|
| 76 |
+
"full_attention": {
|
| 77 |
+
"factor": 8.0,
|
| 78 |
+
"rope_theta": 1000000.0,
|
| 79 |
+
"rope_type": "linear"
|
| 80 |
+
},
|
| 81 |
+
"sliding_attention": {
|
| 82 |
+
"rope_theta": 10000.0,
|
| 83 |
+
"rope_type": "default"
|
| 84 |
+
}
|
| 85 |
+
},
|
| 86 |
+
"sliding_window": 1024,
|
| 87 |
+
"sliding_window_pattern": 6,
|
| 88 |
+
"tie_word_embeddings": true,
|
| 89 |
+
"use_bidirectional_attention": false,
|
| 90 |
+
"use_cache": true,
|
| 91 |
+
"vocab_size": 262208
|
| 92 |
+
},
|
| 93 |
+
"tie_word_embeddings": true,
|
| 94 |
+
"unsloth_fixed": true,
|
| 95 |
+
"unsloth_version": "2026.6.5",
|
| 96 |
+
"use_cache": false,
|
| 97 |
+
"vision_config": {
|
| 98 |
+
"attention_dropout": 0.0,
|
| 99 |
+
"torch_dtype": "float16",
|
| 100 |
+
"hidden_act": "gelu_pytorch_tanh",
|
| 101 |
+
"hidden_size": 1152,
|
| 102 |
+
"image_size": 896,
|
| 103 |
+
"intermediate_size": 4304,
|
| 104 |
+
"layer_norm_eps": 1e-06,
|
| 105 |
+
"model_type": "siglip_vision_model",
|
| 106 |
+
"num_attention_heads": 16,
|
| 107 |
+
"num_channels": 3,
|
| 108 |
+
"num_hidden_layers": 27,
|
| 109 |
+
"patch_size": 14,
|
| 110 |
+
"vision_use_head": false
|
| 111 |
+
}
|
| 112 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 2,
|
| 3 |
+
"cache_implementation": "hybrid",
|
| 4 |
+
"do_sample": true,
|
| 5 |
+
"eos_token_id": [
|
| 6 |
+
1,
|
| 7 |
+
106
|
| 8 |
+
],
|
| 9 |
+
"pad_token_id": 0,
|
| 10 |
+
"top_k": 64,
|
| 11 |
+
"top_p": 0.95,
|
| 12 |
+
"transformers_version": "5.12.0"
|
| 13 |
+
}
|
processor_config.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"image_processor": {
|
| 3 |
+
"do_convert_rgb": null,
|
| 4 |
+
"do_normalize": true,
|
| 5 |
+
"do_rescale": true,
|
| 6 |
+
"do_resize": true,
|
| 7 |
+
"image_mean": [
|
| 8 |
+
0.5,
|
| 9 |
+
0.5,
|
| 10 |
+
0.5
|
| 11 |
+
],
|
| 12 |
+
"image_processor_type": "Gemma3ImageProcessor",
|
| 13 |
+
"image_seq_length": 256,
|
| 14 |
+
"image_std": [
|
| 15 |
+
0.5,
|
| 16 |
+
0.5,
|
| 17 |
+
0.5
|
| 18 |
+
],
|
| 19 |
+
"resample": 2,
|
| 20 |
+
"rescale_factor": 0.00392156862745098,
|
| 21 |
+
"size": {
|
| 22 |
+
"height": 896,
|
| 23 |
+
"width": 896
|
| 24 |
+
}
|
| 25 |
+
},
|
| 26 |
+
"image_seq_length": 256,
|
| 27 |
+
"processor_class": "Gemma3Processor"
|
| 28 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:daab2354f8a74e70d70b4d1f804939b68a8c9624dd06cb7858e52dd8970e9726
|
| 3 |
+
size 33384567
|
tokenizer.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1299c11d7cf632ef3b4e11937501358ada021bbdf7c47638d13c0ee982f2e79c
|
| 3 |
+
size 4689074
|
tokenizer_config.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|