Instructions to use JMingo/gemma-4-31B-it with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use JMingo/gemma-4-31B-it with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="JMingo/gemma-4-31B-it") 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("JMingo/gemma-4-31B-it") model = AutoModelForMultimodalLM.from_pretrained("JMingo/gemma-4-31B-it", 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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use JMingo/gemma-4-31B-it with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "JMingo/gemma-4-31B-it" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "JMingo/gemma-4-31B-it", "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/JMingo/gemma-4-31B-it
- SGLang
How to use JMingo/gemma-4-31B-it 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 "JMingo/gemma-4-31B-it" \ --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": "JMingo/gemma-4-31B-it", "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 "JMingo/gemma-4-31B-it" \ --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": "JMingo/gemma-4-31B-it", "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" } } ] } ] }' - Docker Model Runner
How to use JMingo/gemma-4-31B-it with Docker Model Runner:
docker model run hf.co/JMingo/gemma-4-31B-it
Upload files
Browse files- config.json +2 -1
- generation_config.json +1 -1
- model-00001-of-00004.safetensors +3 -0
- model-00002-of-00004.safetensors +3 -0
- model-00003-of-00004.safetensors +3 -0
- model-00004-of-00004.safetensors +3 -0
- model.safetensors.index.json +0 -0
- tokenizer_config.json +42 -20
config.json
CHANGED
|
@@ -98,6 +98,7 @@
|
|
| 98 |
],
|
| 99 |
"max_position_embeddings": 262144,
|
| 100 |
"model_type": "gemma4_text",
|
|
|
|
| 101 |
"num_attention_heads": 32,
|
| 102 |
"num_experts": null,
|
| 103 |
"num_global_key_value_heads": 4,
|
|
@@ -127,7 +128,7 @@
|
|
| 127 |
"vocab_size_per_layer_input": 262144
|
| 128 |
},
|
| 129 |
"tie_word_embeddings": true,
|
| 130 |
-
"transformers_version": "5.
|
| 131 |
"video_token_id": 258884,
|
| 132 |
"vision_config": {
|
| 133 |
"_name_or_path": "",
|
|
|
|
| 98 |
],
|
| 99 |
"max_position_embeddings": 262144,
|
| 100 |
"model_type": "gemma4_text",
|
| 101 |
+
"moe_intermediate_size": null,
|
| 102 |
"num_attention_heads": 32,
|
| 103 |
"num_experts": null,
|
| 104 |
"num_global_key_value_heads": 4,
|
|
|
|
| 128 |
"vocab_size_per_layer_input": 262144
|
| 129 |
},
|
| 130 |
"tie_word_embeddings": true,
|
| 131 |
+
"transformers_version": "5.9.0",
|
| 132 |
"video_token_id": 258884,
|
| 133 |
"vision_config": {
|
| 134 |
"_name_or_path": "",
|
generation_config.json
CHANGED
|
@@ -10,5 +10,5 @@
|
|
| 10 |
"temperature": 1.0,
|
| 11 |
"top_k": 64,
|
| 12 |
"top_p": 0.95,
|
| 13 |
-
"transformers_version": "5.
|
| 14 |
}
|
|
|
|
| 10 |
"temperature": 1.0,
|
| 11 |
"top_k": 64,
|
| 12 |
"top_p": 0.95,
|
| 13 |
+
"transformers_version": "5.9.0"
|
| 14 |
}
|
model-00001-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7c72d4e19bb3886f03a3f866949049e68316d5909d5b776490afb1db5e5e8924
|
| 3 |
+
size 19798235692
|
model-00002-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fd93de76a1f6fb611f94e199946c8c473d12b77117bd51f5c9b10ce5f435810e
|
| 3 |
+
size 19962172496
|
model-00003-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cebaf169363bf9789f4e6929c6eea9914ffbb777f4412b0f768e5f7c4cacae18
|
| 3 |
+
size 19852048162
|
model-00004-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:468322439b070e8ab3cc0d8ce62943db0a4f0d6f089d0d6d138ace451c13861e
|
| 3 |
+
size 2933880890
|
model.safetensors.index.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
CHANGED
|
@@ -17,50 +17,72 @@
|
|
| 17 |
"<|video|>"
|
| 18 |
],
|
| 19 |
"image_token": "<|image|>",
|
|
|
|
|
|
|
| 20 |
"mask_token": "<mask>",
|
| 21 |
"model_max_length": 1000000000000000019884624838656,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
"pad_token": "<pad>",
|
| 23 |
"padding_side": "left",
|
| 24 |
"processor_class": "Gemma4Processor",
|
| 25 |
"response_schema": {
|
| 26 |
-
"type": "object",
|
| 27 |
"properties": {
|
|
|
|
|
|
|
|
|
|
| 28 |
"role": {
|
| 29 |
"const": "assistant"
|
| 30 |
},
|
| 31 |
"thinking": {
|
| 32 |
"type": "string"
|
| 33 |
},
|
| 34 |
-
"content": {
|
| 35 |
-
"type": "string"
|
| 36 |
-
},
|
| 37 |
"tool_calls": {
|
| 38 |
-
"x-regex-iterator": "<\\|tool_call>(.*?)<tool_call\\|>",
|
| 39 |
-
"type": "array",
|
| 40 |
"items": {
|
| 41 |
-
"type": "object",
|
| 42 |
"properties": {
|
| 43 |
-
"type": {
|
| 44 |
-
"const": "function"
|
| 45 |
-
},
|
| 46 |
"function": {
|
| 47 |
-
"type": "object",
|
| 48 |
-
"x-regex": "call\\:(?P<name>\\w+)(?P<arguments>\\{.*\\})",
|
| 49 |
"properties": {
|
| 50 |
-
"name": {
|
| 51 |
-
"type": "string"
|
| 52 |
-
},
|
| 53 |
"arguments": {
|
|
|
|
| 54 |
"type": "object",
|
| 55 |
-
"x-parser": "gemma4-tool-call"
|
| 56 |
-
|
|
|
|
|
|
|
| 57 |
}
|
| 58 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
}
|
| 60 |
-
}
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
| 62 |
}
|
| 63 |
},
|
|
|
|
| 64 |
"x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?P<content>(?:(?!\\<turn\\|\\>)(?!\\<\\|tool_response\\>).)+)?(?:\\<turn\\|\\>|\\<\\|tool_response\\>)?"
|
| 65 |
},
|
| 66 |
"soc_token": "<|channel>",
|
|
|
|
| 17 |
"<|video|>"
|
| 18 |
],
|
| 19 |
"image_token": "<|image|>",
|
| 20 |
+
"is_local": true,
|
| 21 |
+
"local_files_only": false,
|
| 22 |
"mask_token": "<mask>",
|
| 23 |
"model_max_length": 1000000000000000019884624838656,
|
| 24 |
+
"model_specific_special_tokens": {
|
| 25 |
+
"audio_token": "<|audio|>",
|
| 26 |
+
"boa_token": "<|audio>",
|
| 27 |
+
"boi_token": "<|image>",
|
| 28 |
+
"eoa_token": "<audio|>",
|
| 29 |
+
"eoc_token": "<channel|>",
|
| 30 |
+
"eoi_token": "<image|>",
|
| 31 |
+
"eot_token": "<turn|>",
|
| 32 |
+
"escape_token": "<|\"|>",
|
| 33 |
+
"etc_token": "<tool_call|>",
|
| 34 |
+
"etd_token": "<tool|>",
|
| 35 |
+
"etr_token": "<tool_response|>",
|
| 36 |
+
"image_token": "<|image|>",
|
| 37 |
+
"soc_token": "<|channel>",
|
| 38 |
+
"sot_token": "<|turn>",
|
| 39 |
+
"stc_token": "<|tool_call>",
|
| 40 |
+
"std_token": "<|tool>",
|
| 41 |
+
"str_token": "<|tool_response>",
|
| 42 |
+
"think_token": "<|think|>"
|
| 43 |
+
},
|
| 44 |
"pad_token": "<pad>",
|
| 45 |
"padding_side": "left",
|
| 46 |
"processor_class": "Gemma4Processor",
|
| 47 |
"response_schema": {
|
|
|
|
| 48 |
"properties": {
|
| 49 |
+
"content": {
|
| 50 |
+
"type": "string"
|
| 51 |
+
},
|
| 52 |
"role": {
|
| 53 |
"const": "assistant"
|
| 54 |
},
|
| 55 |
"thinking": {
|
| 56 |
"type": "string"
|
| 57 |
},
|
|
|
|
|
|
|
|
|
|
| 58 |
"tool_calls": {
|
|
|
|
|
|
|
| 59 |
"items": {
|
|
|
|
| 60 |
"properties": {
|
|
|
|
|
|
|
|
|
|
| 61 |
"function": {
|
|
|
|
|
|
|
| 62 |
"properties": {
|
|
|
|
|
|
|
|
|
|
| 63 |
"arguments": {
|
| 64 |
+
"additionalProperties": {},
|
| 65 |
"type": "object",
|
| 66 |
+
"x-parser": "gemma4-tool-call"
|
| 67 |
+
},
|
| 68 |
+
"name": {
|
| 69 |
+
"type": "string"
|
| 70 |
}
|
| 71 |
+
},
|
| 72 |
+
"type": "object",
|
| 73 |
+
"x-regex": "call\\:(?P<name>\\w+)(?P<arguments>\\{.*\\})"
|
| 74 |
+
},
|
| 75 |
+
"type": {
|
| 76 |
+
"const": "function"
|
| 77 |
}
|
| 78 |
+
},
|
| 79 |
+
"type": "object"
|
| 80 |
+
},
|
| 81 |
+
"type": "array",
|
| 82 |
+
"x-regex-iterator": "<\\|tool_call>(.*?)<tool_call\\|>"
|
| 83 |
}
|
| 84 |
},
|
| 85 |
+
"type": "object",
|
| 86 |
"x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?P<content>(?:(?!\\<turn\\|\\>)(?!\\<\\|tool_response\\>).)+)?(?:\\<turn\\|\\>|\\<\\|tool_response\\>)?"
|
| 87 |
},
|
| 88 |
"soc_token": "<|channel>",
|