AIDC-AI / Ovis2-4B-GPTQ-Int4

huggingface.co
Total runs: 203
24-hour runs: 0
7-day runs: -17
30-day runs: -300
Model's Last Updated: March 25 2025
image-text-to-text

Introduction of Ovis2-4B-GPTQ-Int4

Model Details of Ovis2-4B-GPTQ-Int4

Ovis2-4B-GPTQ-Int4

Introduction

GitHub | Paper

We are pleased to announce the release of Ovis2 , our latest advancement in multi-modal large language models (MLLMs). Ovis2 inherits the innovative architectural design of the Ovis series, aimed at structurally aligning visual and textual embeddings. As the successor to Ovis1.6, Ovis2 incorporates significant improvements in both dataset curation and training methodologies.

Key Features :

  • Small Model Performance : Optimized training strategies enable small-scale models to achieve higher capability density, demonstrating cross-tier leading advantages.

  • Enhanced Reasoning Capabilities : Significantly strengthens Chain-of-Thought (CoT) reasoning abilities through the combination of instruction tuning and preference learning.

  • Video and Multi-Image Processing : Video and multi-image data are incorporated into training to enhance the ability to handle complex visual information across frames and images.

  • Multilingual Support and OCR : Enhances multilingual OCR beyond English and Chinese and improves structured data extraction from complex visual elements like tables and charts.

Model Zoo
Ovis MLLMs ViT LLM Model Weights Demo
Ovis2-1B aimv2-large-patch14-448 Qwen2.5-0.5B-Instruct Huggingface Space
Ovis2-2B aimv2-large-patch14-448 Qwen2.5-1.5B-Instruct Huggingface Space
Ovis2-4B aimv2-huge-patch14-448 Qwen2.5-3B-Instruct Huggingface Space
Ovis2-8B aimv2-huge-patch14-448 Qwen2.5-7B-Instruct Huggingface Space
Ovis2-16B aimv2-huge-patch14-448 Qwen2.5-14B-Instruct Huggingface Space
Ovis2-34B aimv2-1B-patch14-448 Qwen2.5-32B-Instruct Huggingface -
Ovis2-2B-GPTQ-Int4 aimv2-large-patch14-448 Qwen2.5-1.5B-Instruct Huggingface -
Ovis2-4B-GPTQ-Int4 aimv2-huge-patch14-448 Qwen2.5-3B-Instruct Huggingface -
Ovis2-8B-GPTQ-Int4 aimv2-huge-patch14-448 Qwen2.5-7B-Instruct Huggingface -
Ovis2-16B-GPTQ-Int4 aimv2-huge-patch14-448 Qwen2.5-14B-Instruct Huggingface -
Ovis2-34B-GPTQ-Int4 aimv2-1B-patch14-448 Qwen2.5-32B-Instruct Huggingface Space
Ovis2-34B-GPTQ-Int8 aimv2-1B-patch14-448 Qwen2.5-32B-Instruct Huggingface -
Quantized Models

We quantized Ovis2 with GPTQModel . Follow these steps to launch it.

Installation

Run the following commands to get a basic environment. Be sure to run with CUDA 12.1.

conda create -n <your_env_name> python=3.10
conda activate <your_env_name>
pip install torch==2.4.0 transformers==4.49.0 pillow==10.3.0
pip install flash-attn==2.7.0.post2 --no-build-isolation
pip install gptqmodel
pip install numpy==1.25.0
Usage

Below is a code snippet to run quantized Ovis2 series with multimodal inputs. For additional usage instructions, including inference wrapper and Gradio UI, please refer to Ovis GitHub .

import torch
from PIL import Image
from transformers import GenerationConfig
from gptqmodel import GPTQModel

# load model
# customize load device
load_device = "cuda:0"
torch.cuda.set_device(load_device)
# We take AIDC-AI/Ovis2-34B-GPTQ-Int4 as an example. Note that the code snippet is 
# applicable to any GPTQ-quantized Ovis2 model.
model = GPTQModel.load("AIDC-AI/Ovis2-34B-GPTQ-Int4", device=load_device, trust_remote_code=True)
model.model.generation_config = GenerationConfig.from_pretrained("AIDC-AI/Ovis2-34B-GPTQ-Int4")
text_tokenizer = model.get_text_tokenizer()
visual_tokenizer = model.get_visual_tokenizer()

# For inference, quantization affects only the model loading part. The rest is the same 
# as unquantized Ovis2 models. Here we show how to inference with single image input 
# and without batching. For other input types and batch inference, please refer to
# https://huggingface.co/AIDC-AI/Ovis2-34B.
image_path = input("Enter image path: ")
images = [Image.open(image_path)]
max_partition = 9
text = input("Enter prompt: ")
query = f'<image>\n{text}'

# format conversation
prompt, input_ids, pixel_values = model.preprocess_inputs(query, images, max_partition=max_partition)
attention_mask = torch.ne(input_ids, text_tokenizer.pad_token_id)
input_ids = input_ids.unsqueeze(0).to(device=model.device)
attention_mask = attention_mask.unsqueeze(0).to(device=model.device)
if pixel_values is not None:
    pixel_values = pixel_values.to(dtype=visual_tokenizer.dtype, device=visual_tokenizer.device)
pixel_values = [pixel_values]

# generate output
with torch.inference_mode():
    gen_kwargs = dict(
        max_new_tokens=1024,
        do_sample=False,
        top_p=None,
        top_k=None,
        temperature=None,
        repetition_penalty=None,
        eos_token_id=model.generation_config.eos_token_id,
        pad_token_id=text_tokenizer.pad_token_id,
        use_cache=True
    )
    output_ids = model.generate(input_ids, pixel_values=pixel_values, attention_mask=attention_mask, **gen_kwargs)[0]
    output = text_tokenizer.decode(output_ids, skip_special_tokens=True)
    print(f'Output:\n{output}')
Quantize Your Own Ovis2 Model with GPTQModel

We provide a demonstration code snippet for you to quantize your own fine-tuned Ovis2 model. Before running the code, you need to follow the ABOVE installation steps to obtain an environment for quantization.

import torch
from gptqmodel import QuantizeConfig, GPTQModel

model_path = "path/to/finetuned/model"
quantize_save_path = "path/to/save/quantized/model"

quantize_config = QuantizeConfig(
    bits=4,  # 4 or 8
    group_size=128  # it is recommended to set the value to 128
)

model = GPTQModel.load(
    model_path,
    quantize_config,
    torch_dtype=torch.bfloat16,
    trust_remote_code=True,
    use_cache=False
)
model.model.llm.model.config.use_cache = False
model.model.config.llm_config.use_cache = False


# Data list for calibration, should be in the following format:
# Single Image/Multi-Image/Video: For video input, frames should be pre-selected and form 
# a list, thus equaling multi-image input. See more on video input in 
# https://huggingface.co/AIDC-AI/Ovis2-34B.
# data_list = [
#     {
#         "image": ["path/to/image(s)/of/this/sample", ...],
#         "conversations": [
#             {
#                 "from": "human",
#                 "value": "<image>\n[Your sample prompt]" 
#                 # For multi-image input, the number of '<image>' marks should be equal 
#                 # to the number of input images. For video input, the mark should be a 
#                 # single '<video>'.
#             },
#             {
#                 "from": "gpt",
#                 "value": "[Your sample answer]"
#             }
#         ]
#     },
#     ...
# ]
# 
# Pure Text
# data_list = [
#     {
#         "conversations": [
#             {
#                 "from": "human",
#                 "value": "[Your sample prompt]"
#             },
#             {
#                 "from": "gpt",
#                 "value": "[Your sample answer]"
#             }
#         ]
#     },
#     ...
# ]
data_list = [...]


model.quantize(data_list, batch_size=1, calibration_enable_gpu_cache=True)
print(f"Quantized! Now Saving...")

model.save(quantize_save_path, max_shard_size='5GB')
print(f"ALL Done!")
Performance

We report the performance of the quantized Ovis2 series. OpenCompass results are evaluated with VLMEvalkit .

image/png

image/png

Citation

If you find Ovis useful, please consider citing the paper

@article{lu2024ovis,
  title={Ovis: Structural Embedding Alignment for Multimodal Large Language Model},
  author={Shiyin Lu and Yang Li and Qing-Guo Chen and Zhao Xu and Weihua Luo and Kaifu Zhang and Han-Jia Ye},
  year={2024},
  journal={arXiv:2405.20797}
}
License

This project is licensed under the Apache License, Version 2.0 (SPDX-License-Identifier: Apache-2.0).

Disclaimer

We used compliance-checking algorithms during the training process, to ensure the compliance of the trained model to the best of our ability. Due to the complexity of the data and the diversity of language model usage scenarios, we cannot guarantee that the model is completely free of copyright issues or improper content. If you believe anything infringes on your rights or generates improper content, please contact us, and we will promptly address the matter.

Runs of AIDC-AI Ovis2-4B-GPTQ-Int4 on huggingface.co

203
Total runs
0
24-hour runs
20
3-day runs
-17
7-day runs
-300
30-day runs

More Information About Ovis2-4B-GPTQ-Int4 huggingface.co Model

More Ovis2-4B-GPTQ-Int4 license Visit here:

https://choosealicense.com/licenses/apache-2.0

Ovis2-4B-GPTQ-Int4 huggingface.co

Ovis2-4B-GPTQ-Int4 huggingface.co is an AI model on huggingface.co that provides Ovis2-4B-GPTQ-Int4's model effect (), which can be used instantly with this AIDC-AI Ovis2-4B-GPTQ-Int4 model. huggingface.co supports a free trial of the Ovis2-4B-GPTQ-Int4 model, and also provides paid use of the Ovis2-4B-GPTQ-Int4. Support call Ovis2-4B-GPTQ-Int4 model through api, including Node.js, Python, http.

Ovis2-4B-GPTQ-Int4 huggingface.co Url

https://huggingface.co/AIDC-AI/Ovis2-4B-GPTQ-Int4

AIDC-AI Ovis2-4B-GPTQ-Int4 online free

Ovis2-4B-GPTQ-Int4 huggingface.co is an online trial and call api platform, which integrates Ovis2-4B-GPTQ-Int4's modeling effects, including api services, and provides a free online trial of Ovis2-4B-GPTQ-Int4, you can try Ovis2-4B-GPTQ-Int4 online for free by clicking the link below.

AIDC-AI Ovis2-4B-GPTQ-Int4 online free url in huggingface.co:

https://huggingface.co/AIDC-AI/Ovis2-4B-GPTQ-Int4

Ovis2-4B-GPTQ-Int4 install

Ovis2-4B-GPTQ-Int4 is an open source model from GitHub that offers a free installation service, and any user can find Ovis2-4B-GPTQ-Int4 on GitHub to install. At the same time, huggingface.co provides the effect of Ovis2-4B-GPTQ-Int4 install, users can directly use Ovis2-4B-GPTQ-Int4 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

Ovis2-4B-GPTQ-Int4 install url in huggingface.co:

https://huggingface.co/AIDC-AI/Ovis2-4B-GPTQ-Int4

Url of Ovis2-4B-GPTQ-Int4

Ovis2-4B-GPTQ-Int4 huggingface.co Url

Provider of Ovis2-4B-GPTQ-Int4 huggingface.co

AIDC-AI
ORGANIZATIONS

Other API from AIDC-AI

huggingface.co

Total runs: 117.5K
Run Growth: 4.7K
Growth Rate: 3.98%
Updated:August 15 2025
huggingface.co

Total runs: 18.8K
Run Growth: 14.3K
Growth Rate: 76.35%
Updated:February 13 2026
huggingface.co

Total runs: 12.5K
Run Growth: -13.7K
Growth Rate: -109.21%
Updated:February 13 2026
huggingface.co

Total runs: 11.3K
Run Growth: -35.3K
Growth Rate: -312.00%
Updated:August 15 2025
huggingface.co

Total runs: 1.6K
Run Growth: 0
Growth Rate: 0.00%
Updated:February 26 2025
huggingface.co

Total runs: 1.4K
Run Growth: 270
Growth Rate: 19.58%
Updated:March 04 2025
huggingface.co

Total runs: 982
Run Growth: -45.0K
Growth Rate: -4582.28%
Updated:August 15 2025
huggingface.co

Total runs: 688
Run Growth: 387
Growth Rate: 56.25%
Updated:August 15 2025
huggingface.co

Total runs: 426
Run Growth: -476
Growth Rate: -111.74%
Updated:July 03 2025
huggingface.co

Total runs: 398
Run Growth: -7
Growth Rate: -1.76%
Updated:November 23 2024
huggingface.co

Total runs: 326
Run Growth: 320
Growth Rate: 98.16%
Updated:June 09 2026
huggingface.co

Total runs: 300
Run Growth: -37
Growth Rate: -12.33%
Updated:August 15 2025
huggingface.co

Total runs: 59
Run Growth: -898
Growth Rate: -1522.03%
Updated:February 28 2025
huggingface.co

Total runs: 39
Run Growth: 28
Growth Rate: 71.79%
Updated:May 29 2025
huggingface.co

Total runs: 38
Run Growth: -6
Growth Rate: -15.79%
Updated:August 15 2025
huggingface.co

Total runs: 27
Run Growth: 9
Growth Rate: 33.33%
Updated:November 21 2024
huggingface.co

Total runs: 13
Run Growth: 8
Growth Rate: 61.54%
Updated:July 30 2025
huggingface.co

Total runs: 11
Run Growth: -14
Growth Rate: -127.27%
Updated:November 21 2024
huggingface.co

Total runs: 6
Run Growth: 1
Growth Rate: 16.67%
Updated:August 19 2025
huggingface.co

Total runs: 6
Run Growth: 0
Growth Rate: 0.00%
Updated:November 14 2024
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:December 19 2025
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:December 03 2025