NicoZenith commited on
Commit
ea711ae
·
verified ·
1 Parent(s): bc4fa15

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +24 -0
README.md ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Usage
2
+ ```python
3
+ from transformers import AutoProcessor, LlavaOnevisionForConditionalGeneration
4
+
5
+ model = LlavaOnevisionForConditionalGeneration.from_pretrained("NicoZenith/onevision-7b-all-vqa-conv")
6
+ processor = AutoProcessor.from_pretrained("NicoZenith/onevision-7b-all-vqa-conv")i
7
+
8
+ conversation = [
9
+ {
10
+
11
+ "role": "user",
12
+ "content": [
13
+ {"type": "text", "text": "What can you say about this X-ray?"},
14
+ {"type": "image"},
15
+ ],
16
+ },
17
+ ]
18
+
19
+
20
+ prompt = processor.apply_chat_template(conversation, add_generation_prompt=True)
21
+
22
+ image_file = "http://images.cocodataset.org/val2017/000000039769.jpg"
23
+ raw_image = Image.open(requests.get(image_file, stream=True).raw)
24
+ inputs = processor(images=raw_image, text=prompt, return_tensors='pt').to(0, torch.float16)