Downloads · 30 days
8
4% of all-time downloads
useful-quants/InternVL3-5-8B-W4A16-INT4
InternVL3-5-8B-W4A16-INT4 is a image-text-to-text model from useful-quants. Use it for the image-text-to-text task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
RTN W4A16 INT4 quantization of OpenGVLab/InternVL35-8B targeting Ampere GPUs (RTX 3000/4000 series, A100, etc.).
Downloads · 30 days
8
4% of all-time downloads
All-time downloads
191
Public
Parameters
2.5B
6.8 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors6.7 GB · 100%
How the weights are stored.
I326.9B · 81%
From the Hugging Face model README
RTN W4A16 INT4 quantization of OpenGVLab/InternVL3_5-8B targeting Ampere GPUs (RTX 3000/4000 series, A100, etc.).
weight_packed int32 + BF16 group scales, group_size=128)vision_model.*): BF16 — untouchedmlp1.*): BF16 — untouchedcompressed-tensors pack-quantized — loaded natively by vllm| Test | Result |
|---|---|
| sqrt(144) + closest planet to Sun | ✓ 12, Mercury |
| Golden Gate Bridge image (Wikimedia) | ✓ Correct ID, no hallucination |
vllm serve useful-quants/InternVL3-5-8B-W4A16-INT4 \
--dtype bfloat16 \
--max-model-len 8192 \
--max-num-seqs 16 \
--gpu-memory-utilization 0.90
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"useful-quants/InternVL3-5-8B-W4A16-INT4",
dtype=torch.bfloat16,
device_map="cuda:0",
trust_remote_code=True,
)
tokenizer = AutoTokenizer.from_pretrained(
"useful-quants/InternVL3-5-8B-W4A16-INT4",
trust_remote_code=True,
)
# Text-only
response = model.chat(tokenizer, pixel_values=None,
question="Hello!", generation_config=dict(max_new_tokens=256))
# With image
from PIL import Image
import torchvision.transforms as T
from torchvision.transforms.functional import InterpolationMode
MEAN, STD = (0.485, 0.456, 0.406), (0.229, 0.224, 0.225)
tf = T.Compose([
T.Resize((448, 448), interpolation=InterpolationMode.BICUBIC),
T.ToTensor(), T.Normalize(MEAN, STD),
])
pixel_values = tf(Image.open("image.jpg").convert("RGB")).unsqueeze(0)
pixel_values = pixel_values.to(model.device, dtype=torch.bfloat16)
response = model.chat(tokenizer, pixel_values=pixel_values,
question="<image>\nDescribe this image.",
generation_config=dict(max_new_tokens=256))
QuantizationModifier(scheme="W4A16")trust_remote_code=True required for both loading and inferencefix_mistral_regex) is cosmetic and does not affect output quality