metadata
base_model:
- Qwen/Qwen2-VL-2B-Instruct
This is the Qwen/Qwen2-VL-2B-Instruct model, converted to OpenVINO, with int4 weights for the language model, int8 weights for the other models.
Use OpenVINO GenAI to run inference on this model:
- Install OpenVINO GenAI nightly and pillow:
pip install --upgrade --pre pillow openvino-genai openvino openvino-tokenizers --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly
- Download a test image:
curl -O "https://storage.openvinotoolkit.org/test_data/images/dog.jpg"
- Run inference:
import numpy as np
import openvino as ov
import openvino_genai
from PIL import Image
# Choose GPU instead of CPU in the line below to run the model on Intel integrated or discrete GPU
pipe = openvino_genai.VLMPipeline("./Qwen2-VL-2B-Instruct-ov-int4", "CPU")
pipe.start_chat()
image = Image.open("dog.jpg")
image_data = np.array(image.getdata()).reshape(1, image.size[1], image.size[0], 3).astype(np.uint8)
image_data = ov.Tensor(image_data)
prompt = "Can you describe the image?"
result = pipe.generate(prompt, image=image_data, max_new_tokens=100)
print(result.texts[0])