Downloads · 30 days
53
6% of all-time downloads
OPEA/Llama-3.2-11B-Vision-Instruct-qvision-int4-sym-inc
Llama-3.2-11B-Vision-Instruct-qvision-int4-sym-inc is a machine learning model from OPEA. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This model is an int4 model(The vision module has also been quantized) with groupsize 128 and symmetric quantization of meta-llama/Llama-3.2-11B-Vision-Instruct generated by intel/auto-round.
Downloads · 30 days
53
6% of all-time downloads
All-time downloads
926
Public
Parameters
2.4B
7.3 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors7.3 GB · 100%
How the weights are stored.
I321.2B · 49%
From the Hugging Face model README
This model is an int4 model(The vision module has also been quantized) with group_size 128 and symmetric quantization of meta-llama/Llama-3.2-11B-Vision-Instruct generated by intel/auto-round.
auto-round>0.51
transformers>=4.52.0
import requests
import torch
from PIL import Image
from transformers import MllamaForConditionalGeneration, AutoProcessor
quantized_model_path="OPEA/Llama-3.2-11B-Vision-Instruct-qvision-int4-sym-inc"
model = MllamaForConditionalGeneration.from_pretrained(
quantized_model_path,
torch_dtype="auto",
device_map="auto"
)
processor = AutoProcessor.from_pretrained(quantized_model_path)
image_url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/0052a70beed5bf71b92610a43a52df6d286cd5f3/diffusers/rabbit.jpg"
messages = [
{"role": "user", "content": [
{"type": "image"},
{"type": "text", "text": "Please write a haiku for this one, it would be: "}
]}
]
# Preparation for inference
image = Image.open(requests.get(image_url, stream=True).raw)
input_text = processor.apply_chat_template(messages, add_generation_prompt=True)
inputs = processor(
image,
input_text,
add_special_tokens=False,
return_tensors="pt"
).to(model.device)
output = model.generate(**inputs, max_new_tokens=50)
print(processor.decode(output[0]))
##INT4:
## A rabbit in a coat,
## Walking down a dirt road
## Nature's gentle charm<|eot_id|>
##BF16:
## Here is a haiku for the rabbit:
## Whiskers twitching fast
## In a coat of blue and brown
## Hoppy little soul<|eot_id|>
image_url = "http://images.cocodataset.org/train2017/000000411975.jpg"
messages = [
{"role": "user", "content": [
{"type": "image"},
{"type": "text", "text": "How many people are on the baseball field in the picture?"}
]}
]
##INT4: There are five people on the baseball field in the picture.
##
##BF16: There are five people on the baseball field in the picture.
##
image_url = "https://intelcorp.scene7.com/is/image/intelcorp/processor-overview-framed-badge:1920-1080?wid=480&hei=270"
messages = [
{"role": "user", "content": [
{"type": "image"},
{"type": "text", "text": "Which company does this picture represent?"}
]}
]
##INT4: Intel.
##
##BF16: This image represents Intel, a multinational semiconductor corporation headquartered in Santa Clara, California.
##
pip3 install git+https://github.com/open-compass/VLMEvalKit.git@7de2dcb. The evaluation process may encounter errors that require changing model backend or evaluation code. Detailed instructions will be provided in a future update.
auto-round-mllm --eval --model OPEA/Llama-3.2-11B-Vision-Instruct-qvision-int4-sym-inc --tasks MMBench_DEV_EN_V11,ScienceQA_VAL,TextVQA_VAL,POPE --output_dir "./eval_result"
| Metric | 16bits | Llava Calib INT4 |
|---|---|---|
| avg | 66.05 | |
| MMBench_DEV_EN_V11 | 52.86 | 50.23 |
| ScienceQA_VAL | 68.86 | 68.24 |
| TextVQA_VAL | 54.49 | |
| POPE | 88.00 |
Here is the sample command to reproduce the model.
pip install auto-round
auto-round-mllm \
--model meta-llama/Llama-3.2-11B-Vision-Instruct \
--device 0 \
--group_size 128 \
--bits 4 \
--iters 200 \
--nsample 128 \
--seqlen 512 \
--quant_nontext_module \
--format 'auto_round' \
--output_dir "./tmp_autoround"
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.
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:
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.
@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} }