🚀 QVQ-72B-Preview-abliterated-GPTQ-Int8
This is a GPTQ-quantized 8-bit version of huihui-ai/QVQ-72B-Preview-abliterated, offering a toolkit for convenient handling of various visual inputs.
🚀 Quick Start
This project provides a GPTQ-quantized 8-bit version of the model, along with a toolkit to handle different types of visual inputs.
✨ Features
- GPTQ quantization to 8-bit, which can effectively reduce model size and inference time.
- Support for various visual input types, including base64, URLs, and interleaved images and videos.
- Provide a convenient toolkit to simplify the processing of visual inputs.
📦 Installation
You can install the necessary toolkit using the following command:
pip install qwen-vl-utils
💻 Usage Examples
Basic Usage
The following is a code example demonstrating how to use the chat model with transformers
and qwen_vl_utils
:
from transformers import Qwen2VLForConditionalGeneration, AutoTokenizer, AutoProcessor
from qwen_vl_utils import process_vision_info
model = Qwen2VLForConditionalGeneration.from_pretrained(
"huihui-ai/QVQ-72B-Preview-abliterated-GPTQ-Int8", torch_dtype="auto", device_map="auto"
)
processor = AutoProcessor.from_pretrained("huihui-ai/QVQ-72B-Preview-abliterated-GPTQ-Int8")
messages = [
{
"role": "system",
"content": [
{"type": "text", "text": "You are a helpful and harmless assistant. You are Qwen developed by Alibaba. You should think step-by-step."}
],
},
{
"role": "user",
"content": [
{
"type": "image",
"image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/QVQ/demo.png",
},
{"type": "text", "text": "What value should be filled in the blank space?"},
],
}
]
text = processor.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)
image_inputs, video_inputs = process_vision_info(messages)
inputs = processor(
text=[text],
images=image_inputs,
videos=video_inputs,
padding=True,
return_tensors="pt",
)
inputs = inputs.to("cuda")
generated_ids = model.generate(**inputs, max_new_tokens=8192)
generated_ids_trimmed = [
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
]
output_text = processor.batch_decode(
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
)
print(output_text)
📄 License
This project uses the Qwen License.