Image-Text-to-Text
Transformers
Safetensors
gemma4
quantization
nvfp4
conversational
8-bit precision
compressed-tensors
Instructions to use yasu-oh/gemma-4-31B-it-qat-NVFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use yasu-oh/gemma-4-31B-it-qat-NVFP4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="yasu-oh/gemma-4-31B-it-qat-NVFP4") 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("yasu-oh/gemma-4-31B-it-qat-NVFP4") model = AutoModelForMultimodalLM.from_pretrained("yasu-oh/gemma-4-31B-it-qat-NVFP4", 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 yasu-oh/gemma-4-31B-it-qat-NVFP4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yasu-oh/gemma-4-31B-it-qat-NVFP4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yasu-oh/gemma-4-31B-it-qat-NVFP4", "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/yasu-oh/gemma-4-31B-it-qat-NVFP4
- SGLang
How to use yasu-oh/gemma-4-31B-it-qat-NVFP4 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 "yasu-oh/gemma-4-31B-it-qat-NVFP4" \ --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": "yasu-oh/gemma-4-31B-it-qat-NVFP4", "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 "yasu-oh/gemma-4-31B-it-qat-NVFP4" \ --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": "yasu-oh/gemma-4-31B-it-qat-NVFP4", "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 yasu-oh/gemma-4-31B-it-qat-NVFP4 with Docker Model Runner:
docker model run hf.co/yasu-oh/gemma-4-31B-it-qat-NVFP4
yasu-oh commited on
Commit ·
7c3a887
1
Parent(s): 28413b5
v4
Browse files- README.md +9 -7
- config.json +2 -2
- model-00001-of-00002.safetensors +3 -0
- model-00002-of-00002.safetensors +3 -0
- recipe.yaml +7 -6
- tokenizer.json +3 -0
README.md
CHANGED
|
@@ -46,11 +46,7 @@ The calibration dataset consists of:
|
|
| 46 |
```yaml
|
| 47 |
default_stage:
|
| 48 |
default_modifiers:
|
| 49 |
-
|
| 50 |
-
targets: [Linear]
|
| 51 |
-
ignore: ['re:.*vision.*', 're:.*audio.*', lm_head, 're:.*embed.*', 're:.*router.*']
|
| 52 |
-
weight_observer: imatrix_mse
|
| 53 |
-
QuantizationModifier:
|
| 54 |
config_groups:
|
| 55 |
group_0:
|
| 56 |
targets: [Linear]
|
|
@@ -62,7 +58,7 @@ default_stage:
|
|
| 62 |
strategy: tensor_group
|
| 63 |
block_structure: null
|
| 64 |
dynamic: false
|
| 65 |
-
actorder:
|
| 66 |
scale_dtype: torch.float8_e4m3fn
|
| 67 |
zp_dtype: null
|
| 68 |
observer: imatrix_mse
|
|
@@ -98,6 +94,11 @@ default_stage:
|
|
| 98 |
observer: static_minmax
|
| 99 |
observer_kwargs: {}
|
| 100 |
bypass_divisibility_checks: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
```
|
| 102 |
|
| 103 |
## Reproducibility
|
|
@@ -110,6 +111,7 @@ The quantization run used:
|
|
| 110 |
|
| 111 |
```text
|
| 112 |
transformers: 5.12.1
|
| 113 |
-
llmcompressor: 0.12.1.
|
|
|
|
| 114 |
```
|
| 115 |
|
|
|
|
| 46 |
```yaml
|
| 47 |
default_stage:
|
| 48 |
default_modifiers:
|
| 49 |
+
GPTQModifier:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
config_groups:
|
| 51 |
group_0:
|
| 52 |
targets: [Linear]
|
|
|
|
| 58 |
strategy: tensor_group
|
| 59 |
block_structure: null
|
| 60 |
dynamic: false
|
| 61 |
+
actorder: static
|
| 62 |
scale_dtype: torch.float8_e4m3fn
|
| 63 |
zp_dtype: null
|
| 64 |
observer: imatrix_mse
|
|
|
|
| 94 |
observer: static_minmax
|
| 95 |
observer_kwargs: {}
|
| 96 |
bypass_divisibility_checks: false
|
| 97 |
+
requires_calibration_data: true
|
| 98 |
+
block_size: 128
|
| 99 |
+
dampening_frac: 0.01
|
| 100 |
+
actorder: static
|
| 101 |
+
offload_hessians: false
|
| 102 |
```
|
| 103 |
|
| 104 |
## Reproducibility
|
|
|
|
| 111 |
|
| 112 |
```text
|
| 113 |
transformers: 5.12.1
|
| 114 |
+
llmcompressor: 0.12.1.dev91+g4bb29d00c
|
| 115 |
+
compressed-tensors: 0.17.2.dev36+g2cff344
|
| 116 |
```
|
| 117 |
|
config.json
CHANGED
|
@@ -40,7 +40,7 @@
|
|
| 40 |
"Linear"
|
| 41 |
],
|
| 42 |
"weights": {
|
| 43 |
-
"actorder":
|
| 44 |
"block_structure": null,
|
| 45 |
"dynamic": false,
|
| 46 |
"group_size": 16,
|
|
@@ -271,7 +271,7 @@
|
|
| 271 |
"quantization_status": "compressed",
|
| 272 |
"sparsity_config": {},
|
| 273 |
"transform_config": {},
|
| 274 |
-
"version": "0.
|
| 275 |
},
|
| 276 |
"text_config": {
|
| 277 |
"attention_bias": false,
|
|
|
|
| 40 |
"Linear"
|
| 41 |
],
|
| 42 |
"weights": {
|
| 43 |
+
"actorder": "static",
|
| 44 |
"block_structure": null,
|
| 45 |
"dynamic": false,
|
| 46 |
"group_size": 16,
|
|
|
|
| 271 |
"quantization_status": "compressed",
|
| 272 |
"sparsity_config": {},
|
| 273 |
"transform_config": {},
|
| 274 |
+
"version": "0.17.2.dev36+g2cff344"
|
| 275 |
},
|
| 276 |
"text_config": {
|
| 277 |
"attention_bias": false,
|
model-00001-of-00002.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2e4308e2eb7c61e4d007fb28009c93dd24571662334bac067962de5d7c2e38cf
|
| 3 |
+
size 19994110824
|
model-00002-of-00002.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9b89e976593cf1c73f63a2618c92920a6e9383d1e91820efcbe944170fde09e9
|
| 3 |
+
size 452731960
|
recipe.yaml
CHANGED
|
@@ -1,10 +1,6 @@
|
|
| 1 |
default_stage:
|
| 2 |
default_modifiers:
|
| 3 |
-
|
| 4 |
-
targets: [Linear]
|
| 5 |
-
ignore: ['re:.*vision.*', 're:.*audio.*', lm_head, 're:.*embed.*', 're:.*router.*']
|
| 6 |
-
weight_observer: imatrix_mse
|
| 7 |
-
QuantizationModifier:
|
| 8 |
config_groups:
|
| 9 |
group_0:
|
| 10 |
targets: [Linear]
|
|
@@ -16,7 +12,7 @@ default_stage:
|
|
| 16 |
strategy: tensor_group
|
| 17 |
block_structure: null
|
| 18 |
dynamic: false
|
| 19 |
-
actorder:
|
| 20 |
scale_dtype: torch.float8_e4m3fn
|
| 21 |
zp_dtype: null
|
| 22 |
observer: imatrix_mse
|
|
@@ -52,3 +48,8 @@ default_stage:
|
|
| 52 |
observer: static_minmax
|
| 53 |
observer_kwargs: {}
|
| 54 |
bypass_divisibility_checks: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
default_stage:
|
| 2 |
default_modifiers:
|
| 3 |
+
GPTQModifier:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
config_groups:
|
| 5 |
group_0:
|
| 6 |
targets: [Linear]
|
|
|
|
| 12 |
strategy: tensor_group
|
| 13 |
block_structure: null
|
| 14 |
dynamic: false
|
| 15 |
+
actorder: static
|
| 16 |
scale_dtype: torch.float8_e4m3fn
|
| 17 |
zp_dtype: null
|
| 18 |
observer: imatrix_mse
|
|
|
|
| 48 |
observer: static_minmax
|
| 49 |
observer_kwargs: {}
|
| 50 |
bypass_divisibility_checks: false
|
| 51 |
+
requires_calibration_data: true
|
| 52 |
+
block_size: 128
|
| 53 |
+
dampening_frac: 0.01
|
| 54 |
+
actorder: static
|
| 55 |
+
offload_hessians: false
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cc8d3a0ce36466ccc1278bf987df5f71db1719b9ca6b4118264f45cb627bfe0f
|
| 3 |
+
size 32169626
|