Model Details
This model is a mixed int4 model with group_size 128 and symmetric quantization of
google/gemma-4-26B-A4B-it generated by
intel/auto-round.
Please follow the license of the original model.
The MoE layers of the language module are quantized to 4 bits, other layers of the language module are quantized to 8 bits, and all remaining components are kept at 16 bits.
The model is quantized with pure RTN mode.
Transformes inference
1from transformers import AutoProcessor, AutoModelForCausalLM
2
3MODEL_ID = "Intel/gemma-4-26B-A4B-it-int4-mixed-AutoRound/"
4# Load model
5processor = AutoProcessor.from_pretrained(MODEL_ID)
6model = AutoModelForCausalLM.from_pretrained(
7 MODEL_ID,
8 dtype="auto",
9 device_map="auto"
10)
11
12
13# Prompt - add image before text
14messages = [
15 {
16 "role": "user", "content": [
17 {"type": "image", "url": "https://raw.githubusercontent.com/google-gemma/cookbook/refs/heads/main/Demos/sample-data/GoldenGate.png"},
18 {"type": "text", "text": "What is shown in this image?"}
19 ]
20 }
21]
22
23# Process input
24inputs = processor.apply_chat_template(
25 messages,
26 tokenize=True,
27 return_dict=True,
28 return_tensors="pt",
29 add_generation_prompt=True,
30).to(model.device)
31input_len = inputs["input_ids"].shape[-1]
32
33# Generate output
34outputs = model.generate(**inputs, max_new_tokens=512)
35response = processor.decode(outputs[0][input_len:], skip_special_tokens=False)
36
37# Parse output
38print(processor.parse_response(response))
{'content': 'This image shows the Golden Gate Bridge in San Francisco, California. It is a large, bright orange-red suspension bridge that spans the entrance to the San Francisco Bay. In the foreground, there is a large stone building (Fort Point) and a rocky coastline, with a large rock sitting in the water. The hills of Marin County can be seen in the background across the water.', 'role': 'assistant'}
Generate the Model
1auto-round
2google/gemma-4-26B-A4B-it
3--layer_config
4'{"model.language_model.layers.\d+.self_attn..*":{"bits":"8"},"model.language_model.layers.\d+.mlp..*":{"bits":"8"},"model.language_model.layers.\d+.router..*":{"bits":"8"}}'
5--iters
60
7--output_dir
8"./quantized"
9--scheme
10W4A16
11--disable_opt_rtn
Ethical Considerations and Limitations
The model can produce factually incorrect output, and should not be relied on to produce factually accurate information. Because of the limitations of the pretrained model and the finetuning datasets, it is possible that this model could generate lewd, biased or otherwise offensive outputs.
Therefore, before deploying any applications of the model, developers should perform safety testing.
Caveats and Recommendations
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model.
Here are a couple of useful links to learn more about Intel's AI software:
Disclaimer
The license on this model does not constitute legal advice. We are not responsible for the actions of third parties who use this model. Please consult an attorney before using this model for commercial purposes.
Cite
@article{cheng2023optimize, title={Optimize weight rounding via signed gradient descent for the quantization of llms}, author={Cheng, Wenhua and Zhang, Weiwei and Shen, Haihao and Cai, Yiyang and He, Xin and Lv, Kaokao and Liu, Yi}, journal={arXiv preprint arXiv:2309.05516}, year={2023} }