Image-Text-to-Text
Transformers
English
gemma3
text-generation-inference
unsloth
conversational
4-bit precision
bitsandbytes
Instructions to use mcrovero/gemma-3-4b-it-unsloth-bnb-4bit-custom-merged with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mcrovero/gemma-3-4b-it-unsloth-bnb-4bit-custom-merged with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="mcrovero/gemma-3-4b-it-unsloth-bnb-4bit-custom-merged") 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("mcrovero/gemma-3-4b-it-unsloth-bnb-4bit-custom-merged") model = AutoModelForMultimodalLM.from_pretrained("mcrovero/gemma-3-4b-it-unsloth-bnb-4bit-custom-merged") 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 mcrovero/gemma-3-4b-it-unsloth-bnb-4bit-custom-merged with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mcrovero/gemma-3-4b-it-unsloth-bnb-4bit-custom-merged" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mcrovero/gemma-3-4b-it-unsloth-bnb-4bit-custom-merged", "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/mcrovero/gemma-3-4b-it-unsloth-bnb-4bit-custom-merged
- SGLang
How to use mcrovero/gemma-3-4b-it-unsloth-bnb-4bit-custom-merged 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 "mcrovero/gemma-3-4b-it-unsloth-bnb-4bit-custom-merged" \ --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": "mcrovero/gemma-3-4b-it-unsloth-bnb-4bit-custom-merged", "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 "mcrovero/gemma-3-4b-it-unsloth-bnb-4bit-custom-merged" \ --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": "mcrovero/gemma-3-4b-it-unsloth-bnb-4bit-custom-merged", "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 Studio
How to use mcrovero/gemma-3-4b-it-unsloth-bnb-4bit-custom-merged 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 mcrovero/gemma-3-4b-it-unsloth-bnb-4bit-custom-merged 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 mcrovero/gemma-3-4b-it-unsloth-bnb-4bit-custom-merged to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for mcrovero/gemma-3-4b-it-unsloth-bnb-4bit-custom-merged to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="mcrovero/gemma-3-4b-it-unsloth-bnb-4bit-custom-merged", max_seq_length=2048, ) - Docker Model Runner
How to use mcrovero/gemma-3-4b-it-unsloth-bnb-4bit-custom-merged with Docker Model Runner:
docker model run hf.co/mcrovero/gemma-3-4b-it-unsloth-bnb-4bit-custom-merged
Update config.json
Browse files- config.json +136 -30
config.json
CHANGED
|
@@ -1,37 +1,143 @@
|
|
| 1 |
{
|
| 2 |
"architectures": [
|
| 3 |
-
"
|
| 4 |
],
|
| 5 |
-
"
|
| 6 |
-
"attention_dropout": 0.0,
|
| 7 |
-
"attn_logit_softcapping": null,
|
| 8 |
"bos_token_id": 2,
|
| 9 |
-
"
|
| 10 |
-
"eos_token_id":
|
| 11 |
-
"
|
| 12 |
-
"head_dim": 256,
|
| 13 |
-
"hidden_activation": "gelu_pytorch_tanh",
|
| 14 |
-
"hidden_size": 2560,
|
| 15 |
"initializer_range": 0.02,
|
| 16 |
-
"
|
| 17 |
-
"
|
| 18 |
-
"model_type": "gemma3_text",
|
| 19 |
-
"num_attention_heads": 8,
|
| 20 |
-
"num_hidden_layers": 34,
|
| 21 |
-
"num_key_value_heads": 4,
|
| 22 |
"pad_token_id": 0,
|
| 23 |
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": 262144,
|
|
|
|
|
|
|
|
|
|
| 10 |
"initializer_range": 0.02,
|
| 11 |
+
"mm_tokens_per_image": 256,
|
| 12 |
+
"model_type": "gemma3",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
"pad_token_id": 0,
|
| 14 |
+
"quantization_config": {
|
| 15 |
+
"_load_in_4bit": true,
|
| 16 |
+
"_load_in_8bit": false,
|
| 17 |
+
"bnb_4bit_compute_dtype": "bfloat16",
|
| 18 |
+
"bnb_4bit_quant_storage": "uint8",
|
| 19 |
+
"bnb_4bit_quant_type": "nf4",
|
| 20 |
+
"bnb_4bit_use_double_quant": true,
|
| 21 |
+
"llm_int8_enable_fp32_cpu_offload": false,
|
| 22 |
+
"llm_int8_has_fp16_weight": false,
|
| 23 |
+
"llm_int8_skip_modules": [
|
| 24 |
+
"lm_head",
|
| 25 |
+
"multi_modal_projector",
|
| 26 |
+
"merger",
|
| 27 |
+
"modality_projection",
|
| 28 |
+
"language_model.model.layers.5.mlp",
|
| 29 |
+
"language_model.model.layers.6.mlp",
|
| 30 |
+
"vision_tower.vision_model.encoder.layers.23.self_attn",
|
| 31 |
+
"language_model.model.layers.4.mlp",
|
| 32 |
+
"language_model.model.layers.1.mlp",
|
| 33 |
+
"vision_tower.vision_model.encoder.layers.24.self_attn",
|
| 34 |
+
"vision_tower.vision_model.encoder.layers.22.self_attn",
|
| 35 |
+
"vision_tower.vision_model.encoder.layers.21.self_attn",
|
| 36 |
+
"vision_tower.vision_model.encoder.layers.19.self_attn",
|
| 37 |
+
"vision_tower.vision_model.encoder.layers.25.self_attn",
|
| 38 |
+
"vision_tower.vision_model.encoder.layers.26.self_attn",
|
| 39 |
+
"language_model.model.layers.3.mlp",
|
| 40 |
+
"vision_tower.vision_model.encoder.layers.25.mlp",
|
| 41 |
+
"vision_tower.vision_model.encoder.layers.19.mlp",
|
| 42 |
+
"vision_tower.vision_model.encoder.layers.20.self_attn",
|
| 43 |
+
"vision_tower.vision_model.encoder.layers.17.mlp",
|
| 44 |
+
"vision_tower.vision_model.encoder.layers.22.mlp",
|
| 45 |
+
"vision_tower.vision_model.encoder.layers.18.self_attn",
|
| 46 |
+
"language_model.model.layers.0.mlp",
|
| 47 |
+
"vision_tower.vision_model.encoder.layers.20.mlp",
|
| 48 |
+
"vision_tower.vision_model.encoder.layers.21.mlp",
|
| 49 |
+
"language_model.model.layers.2.self_attn",
|
| 50 |
+
"vision_tower.vision_model.encoder.layers.15.mlp",
|
| 51 |
+
"vision_tower.vision_model.encoder.layers.17.self_attn",
|
| 52 |
+
"vision_tower.vision_model.encoder.layers.24.mlp",
|
| 53 |
+
"vision_tower.vision_model.encoder.layers.16.mlp",
|
| 54 |
+
"vision_tower.vision_model.encoder.layers.16.self_attn",
|
| 55 |
+
"vision_tower.vision_model.encoder.layers.18.mlp",
|
| 56 |
+
"vision_tower.vision_model.encoder.layers.13.mlp",
|
| 57 |
+
"vision_tower.vision_model.encoder.layers.23.mlp",
|
| 58 |
+
"vision_tower.vision_model.encoder.layers.10.mlp",
|
| 59 |
+
"vision_tower.vision_model.encoder.layers.14.mlp",
|
| 60 |
+
"vision_tower.vision_model.encoder.layers.15.self_attn",
|
| 61 |
+
"vision_tower.vision_model.encoder.layers.11.self_attn",
|
| 62 |
+
"vision_tower.vision_model.encoder.layers.14.self_attn",
|
| 63 |
+
"vision_tower.vision_model.encoder.layers.7.mlp",
|
| 64 |
+
"vision_tower.vision_model.encoder.layers.5.mlp",
|
| 65 |
+
"vision_tower.vision_model.encoder.layers.9.mlp",
|
| 66 |
+
"vision_tower.vision_model.encoder.layers.11.mlp",
|
| 67 |
+
"vision_tower.vision_model.encoder.layers.12.mlp",
|
| 68 |
+
"vision_tower.vision_model.encoder.layers.10.self_attn",
|
| 69 |
+
"vision_tower.vision_model.encoder.layers.13.self_attn",
|
| 70 |
+
"vision_tower.vision_model.encoder.layers.8.mlp",
|
| 71 |
+
"vision_tower.vision_model.encoder.layers.12.self_attn",
|
| 72 |
+
"vision_tower.vision_model.encoder.layers.8.self_attn",
|
| 73 |
+
"vision_tower.vision_model.encoder.layers.4.mlp",
|
| 74 |
+
"vision_tower.vision_model.encoder.layers.4.self_attn",
|
| 75 |
+
"vision_tower.vision_model.encoder.layers.9.self_attn",
|
| 76 |
+
"vision_tower.vision_model.encoder.layers.2.mlp",
|
| 77 |
+
"vision_tower.vision_model.encoder.layers.7.self_attn",
|
| 78 |
+
"vision_tower.vision_model.encoder.layers.3.mlp",
|
| 79 |
+
"vision_tower.vision_model.encoder.layers.6.mlp",
|
| 80 |
+
"vision_tower.vision_model.encoder.layers.1.mlp",
|
| 81 |
+
"vision_tower.vision_model.encoder.layers.6.self_attn",
|
| 82 |
+
"vision_tower.vision_model.encoder.layers.5.self_attn",
|
| 83 |
+
"vision_tower.vision_model.encoder.layers.1.self_attn",
|
| 84 |
+
"vision_tower.vision_model.encoder.layers.3.self_attn",
|
| 85 |
+
"vision_tower.vision_model.encoder.layers.0.mlp",
|
| 86 |
+
"vision_tower.vision_model.encoder.layers.0.self_attn",
|
| 87 |
+
"vision_tower.vision_model.encoder.layers.2.self_attn",
|
| 88 |
+
"vision_tower.vision_model.encoder.layers.26.mlp"
|
| 89 |
+
],
|
| 90 |
+
"llm_int8_threshold": 6.0,
|
| 91 |
+
"load_in_4bit": true,
|
| 92 |
+
"load_in_8bit": false,
|
| 93 |
+
"quant_method": "bitsandbytes"
|
| 94 |
},
|
| 95 |
+
"text_config": {
|
| 96 |
+
"attention_bias": false,
|
| 97 |
+
"attention_dropout": 0.0,
|
| 98 |
+
"attn_logit_softcapping": null,
|
| 99 |
+
"cache_implementation": "hybrid",
|
| 100 |
+
"final_logit_softcapping": null,
|
| 101 |
+
"head_dim": 256,
|
| 102 |
+
"hidden_activation": "gelu_pytorch_tanh",
|
| 103 |
+
"hidden_size": 2560,
|
| 104 |
+
"initializer_range": 0.02,
|
| 105 |
+
"intermediate_size": 10240,
|
| 106 |
+
"max_position_embeddings": 131072,
|
| 107 |
+
"model_type": "gemma3_text",
|
| 108 |
+
"num_attention_heads": 8,
|
| 109 |
+
"num_hidden_layers": 34,
|
| 110 |
+
"num_key_value_heads": 4,
|
| 111 |
+
"query_pre_attn_scalar": 256,
|
| 112 |
+
"rms_norm_eps": 1e-06,
|
| 113 |
+
"rope_local_base_freq": 10000.0,
|
| 114 |
+
"rope_scaling": {
|
| 115 |
+
"factor": 8.0,
|
| 116 |
+
"rope_type": "linear"
|
| 117 |
+
},
|
| 118 |
+
"rope_theta": 1000000.0,
|
| 119 |
+
"sliding_window": 1024,
|
| 120 |
+
"sliding_window_pattern": 6,
|
| 121 |
+
"torch_dtype": "bfloat16",
|
| 122 |
+
"use_cache": true,
|
| 123 |
+
"vocab_size": 262208
|
| 124 |
+
},
|
| 125 |
+
"torch_dtype": "bfloat16",
|
| 126 |
+
"transformers_version": "4.52.0.dev0",
|
| 127 |
+
"unsloth_fixed": true,
|
| 128 |
+
"vision_config": {
|
| 129 |
+
"attention_dropout": 0.0,
|
| 130 |
+
"hidden_act": "gelu_pytorch_tanh",
|
| 131 |
+
"hidden_size": 1152,
|
| 132 |
+
"image_size": 896,
|
| 133 |
+
"intermediate_size": 4304,
|
| 134 |
+
"layer_norm_eps": 1e-06,
|
| 135 |
+
"model_type": "siglip_vision_model",
|
| 136 |
+
"num_attention_heads": 16,
|
| 137 |
+
"num_channels": 3,
|
| 138 |
+
"num_hidden_layers": 27,
|
| 139 |
+
"patch_size": 14,
|
| 140 |
+
"torch_dtype": "bfloat16",
|
| 141 |
+
"vision_use_head": false
|
| 142 |
+
}
|
| 143 |
+
}
|