Skip to content

[Optimization]The quantization speed of the 72B VL model is too slow. #1792

Closed

Description

@zjx-ERROR
import os
from gptqmodel import GPTQModel, QuantizeConfig
from transformers import AutoTokenizer
from datasets import load_dataset

os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "expandable_segments:True"

def format_qwen2_vl_dataset(image, assistant):
    return [
        {
            "role": "user",
            "content": [
                {"type": "image", "image": image},
                {"type": "text", "text": "generate a caption for this image"},
            ],
        },
        {"role": "assistant", "content": assistant},
    ]

def prepare_dataset(n_sample: int = 20):
    dataset = load_dataset("laion/220k-GPT4Vision-captions-from-LIVIS",
                           split=f"train[:{n_sample}]")
    return [
        format_qwen2_vl_dataset(sample["url"], sample["caption"])
        for sample in dataset
    ]


pretrained_model_id = "inclusionAI/UI-Venus-Ground-72B"
quantized_model_id = "UI-Venus-Ground-72B-GPTQ"

dataset = prepare_dataset(n_sample=32)
quantize_config = QuantizeConfig(
    bits=4,
    group_size=128,
    damp_percent=0.1,
    desc_act=False,  # Significantly speeds up inference
    static_groups=False,
    sym=True,
    true_sequential=True,
)

model = GPTQModel.load(
    pretrained_model_id,
    quantize_config=quantize_config,
    device="cuda:0",
    torch_dtype="auto",
)
tokenizer = AutoTokenizer.from_pretrained(pretrained_model_id, use_fast=True)
model.quantize(dataset, auto_gc=False)
model.save(quantized_model_id)

Quantization has been ongoing for more than 10 hours and is still not complete.
CPU: AMD EPYC 7K62 48-Core Processor
RAM: 64GB
GPU: A100-SXM-64GB

Activity

  1. changed the title [-]The quantization speed of the 72B VL model is too slow.[/-] [+][Optimization]The quantization speed of the 72B VL model is too slow.[/+] on Sep 13, 2025
  2. Qubitium commented on Sep 14, 2025

    @Qubitium
    Collaborator

    @zjx-ERROR Did you try increasing batch_size in model.quantize(dataset, auto_gc=False)?

  3. zjx-ERROR commented on Sep 14, 2025

    @zjx-ERROR
    Author

    Yes, I tried, but the result was the same.

    model.quantize(dataset, auto_gc=False, batch_size=16)
  4. Qubitium commented on Sep 14, 2025

    @Qubitium
    Collaborator

    @zjx-ERROR Post your logs. Btw, have you quantized before? You might have a unrealistic expection of quantization speed when it comes to gptq. =) I can check your logs to see if it's normal.

  5. Qubitium commented on Sep 14, 2025

    @Qubitium
    Collaborator
    Image

    ~1 hour. Pretty sure you don't have enough ram. 64GB is not enough to hold 70B model in ram.

  6. ooolmk commented on Jan 28, 2026

    @ooolmk

    I've also noticed that when using GPTQModel to quantize vision-language (VL) models, it often takes 5 to 10 times longer than quantizing a language model of the same size. Just wanted to share this observation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions