Image-Text-to-Text
Transformers
Safetensors
gemma4_unified
quantization
nvfp4
conversational
8-bit precision
compressed-tensors
Instructions to use yasu-oh/gemma-4-12B-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-12B-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-12B-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-12B-it-qat-NVFP4") model = AutoModelForMultimodalLM.from_pretrained("yasu-oh/gemma-4-12B-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-12B-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-12B-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-12B-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-12B-it-qat-NVFP4
- SGLang
How to use yasu-oh/gemma-4-12B-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-12B-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-12B-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-12B-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-12B-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-12B-it-qat-NVFP4 with Docker Model Runner:
docker model run hf.co/yasu-oh/gemma-4-12B-it-qat-NVFP4
yasu-oh commited on
Commit ·
17f72ca
1
Parent(s): 37b77c5
v3
Browse files- README.md +8 -8
- config.json +2 -2
- model.safetensors +3 -0
- recipe.yaml +6 -7
- tokenizer.json +3 -0
README.md
CHANGED
|
@@ -46,12 +46,7 @@ The calibration dataset consists of:
|
|
| 46 |
```yaml
|
| 47 |
default_stage:
|
| 48 |
default_modifiers:
|
| 49 |
-
|
| 50 |
-
requires_calibration_data: true
|
| 51 |
-
targets: [Linear]
|
| 52 |
-
ignore: ['re:.*vision.*', 're:.*audio.*', lm_head, 're:.*embed.*', 're:.*router.*']
|
| 53 |
-
weight_observer: imatrix_mse
|
| 54 |
-
QuantizationModifier:
|
| 55 |
config_groups:
|
| 56 |
group_0:
|
| 57 |
targets: [Linear]
|
|
@@ -63,7 +58,7 @@ default_stage:
|
|
| 63 |
strategy: tensor_group
|
| 64 |
block_structure: null
|
| 65 |
dynamic: false
|
| 66 |
-
actorder:
|
| 67 |
scale_dtype: torch.float8_e4m3fn
|
| 68 |
zp_dtype: null
|
| 69 |
observer: imatrix_mse
|
|
@@ -100,6 +95,10 @@ default_stage:
|
|
| 100 |
observer_kwargs: {}
|
| 101 |
bypass_divisibility_checks: false
|
| 102 |
requires_calibration_data: true
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
```
|
| 104 |
|
| 105 |
## Reproducibility
|
|
@@ -112,6 +111,7 @@ The quantization run used:
|
|
| 112 |
|
| 113 |
```text
|
| 114 |
transformers: 5.12.1
|
| 115 |
-
llmcompressor: 0.12.1.
|
|
|
|
| 116 |
```
|
| 117 |
|
|
|
|
| 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
|
|
|
|
| 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
|
@@ -64,7 +64,7 @@
|
|
| 64 |
"Linear"
|
| 65 |
],
|
| 66 |
"weights": {
|
| 67 |
-
"actorder":
|
| 68 |
"block_structure": null,
|
| 69 |
"dynamic": false,
|
| 70 |
"group_size": 16,
|
|
@@ -107,7 +107,7 @@
|
|
| 107 |
"quantization_status": "compressed",
|
| 108 |
"sparsity_config": {},
|
| 109 |
"transform_config": {},
|
| 110 |
-
"version": "0.
|
| 111 |
},
|
| 112 |
"text_config": {
|
| 113 |
"attention_bias": false,
|
|
|
|
| 64 |
"Linear"
|
| 65 |
],
|
| 66 |
"weights": {
|
| 67 |
+
"actorder": "static",
|
| 68 |
"block_structure": null,
|
| 69 |
"dynamic": false,
|
| 70 |
"group_size": 16,
|
|
|
|
| 107 |
"quantization_status": "compressed",
|
| 108 |
"sparsity_config": {},
|
| 109 |
"transform_config": {},
|
| 110 |
+
"version": "0.17.2.dev36+g2cff344"
|
| 111 |
},
|
| 112 |
"text_config": {
|
| 113 |
"attention_bias": false,
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1a0524f3a54689abece9d7882d3aabb6d08f45cc1ad64cf14c15fd852b1feb5a
|
| 3 |
+
size 8251015456
|
recipe.yaml
CHANGED
|
@@ -1,11 +1,6 @@
|
|
| 1 |
default_stage:
|
| 2 |
default_modifiers:
|
| 3 |
-
|
| 4 |
-
requires_calibration_data: true
|
| 5 |
-
targets: [Linear]
|
| 6 |
-
ignore: ['re:.*vision.*', 're:.*audio.*', lm_head, 're:.*embed.*', 're:.*router.*']
|
| 7 |
-
weight_observer: imatrix_mse
|
| 8 |
-
QuantizationModifier:
|
| 9 |
config_groups:
|
| 10 |
group_0:
|
| 11 |
targets: [Linear]
|
|
@@ -17,7 +12,7 @@ default_stage:
|
|
| 17 |
strategy: tensor_group
|
| 18 |
block_structure: null
|
| 19 |
dynamic: false
|
| 20 |
-
actorder:
|
| 21 |
scale_dtype: torch.float8_e4m3fn
|
| 22 |
zp_dtype: null
|
| 23 |
observer: imatrix_mse
|
|
@@ -54,3 +49,7 @@ default_stage:
|
|
| 54 |
observer_kwargs: {}
|
| 55 |
bypass_divisibility_checks: false
|
| 56 |
requires_calibration_data: true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
|
|
|
| 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
|