helenai commited on
Commit
95c8adf
·
verified ·
1 Parent(s): 69f8e67

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +34 -0
README.md ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model:
3
+ - OpenGVLab/InternVL2-1B
4
+ ---
5
+
6
+ This is the [OpenGVLab/InternVL2-1B](https://huggingface.co/OpenGVLab/InternVL2-1B) model, converted to OpenVINO
7
+ with INT4 compressed weights for the language model, INT8 weights for the other models.
8
+
9
+ Use OpenVINO GenAI to run inference on this model:
10
+
11
+ - `pip install openvino-genai pillow`
12
+ - Download a test image, for example: `curl -O "https://storage.openvinotoolkit.org/test_data/images/dog.jpg"`
13
+ - Run inference:
14
+
15
+ ```python
16
+ import numpy as np
17
+ import openvino as ov
18
+ import openvino_genai
19
+ from PIL import Image
20
+
21
+ # Choose GPU instead of CPU in the line below to run the model on Intel integrated or discrete GPU
22
+ pipe = openvino_genai.VLMPipeline("./InternVL2-1B-ov", "CPU")
23
+ pipe.start_chat()
24
+
25
+ image = Image.open("dog.jpg")
26
+ image_data = np.array(image.getdata()).reshape(1, image.size[1], image.size[0], 3).astype(np.uint8)
27
+ image_data = ov.Tensor(image_data)
28
+
29
+ prompt = "Can you describe the image?"
30
+ result = pipe.generate(prompt, image=image_data, max_new_tokens=100)
31
+ print(result.texts[0])
32
+ ```
33
+
34
+ See [OpenVINO GenAI repository](https://github.com/openvinotoolkit/openvino.genai?tab=readme-ov-file#performing-visual-language-text-generation)