cosmo3769 commited on
Commit
f51a0f3
·
verified ·
1 Parent(s): 3381815

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +22 -9
README.md CHANGED
@@ -14,21 +14,34 @@ should probably proofread and complete it, then remove this comment. -->
14
 
15
  # finetuned_paligemma_vqav2_small
16
 
17
- This model is a fine-tuned version of [google/paligemma-3b-pt-224](https://huggingface.co/google/paligemma-3b-pt-224) on an unknown dataset.
 
18
 
19
- ## Model description
20
 
21
- More information needed
 
 
22
 
23
- ## Intended uses & limitations
 
24
 
25
- More information needed
 
26
 
27
- ## Training and evaluation data
 
28
 
29
- More information needed
 
 
30
 
31
- ## Training procedure
 
 
 
 
 
32
 
33
  ### Training hyperparameters
34
 
@@ -46,7 +59,7 @@ The following hyperparameters were used during training:
46
 
47
  ### Training results
48
 
49
-
50
 
51
  ### Framework versions
52
 
 
14
 
15
  # finetuned_paligemma_vqav2_small
16
 
17
+ This model is a fine-tuned version of [google/paligemma-3b-pt-224](https://huggingface.co/google/paligemma-3b-pt-224) on a small chunk of
18
+ [vqav2 dataset](https://huggingface.co/datasets/merve/vqav2-small) by [Merve](https://huggingface.co/merve).
19
 
20
+ ## How to Use?
21
 
22
+ ```
23
+ import torch
24
+ import requests
25
 
26
+ from PIL import Image
27
+ from transformers import AutoProcessor, PaliGemmaForConditionalGeneration
28
 
29
+ pretrained_model_id = "google/paligemma-3b-pt-224"
30
+ finetuned_model_id = "pyimagesearch/finetuned_paligemma_vqav2_small"
31
 
32
+ processor = AutoProcessor.from_pretrained(pretrained_model_id)
33
+ finetuned_model = PaliGemmaForConditionalGeneration.from_pretrained(finetuned_model_id)
34
 
35
+ prompt = "What is behind the cat?"
36
+ image_file = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/cat.png?download=true"
37
+ raw_image = Image.open(requests.get(image_file, stream=True).raw)
38
 
39
+ inputs = processor(raw_image.convert("RGB"), prompt, return_tensors="pt")
40
+ output = finetuned_model.generate(**inputs, max_new_tokens=20)
41
+
42
+ print(processor.decode(output[0], skip_special_tokens=True)[len(prompt):])
43
+ # gramophone
44
+ ```
45
 
46
  ### Training hyperparameters
47
 
 
59
 
60
  ### Training results
61
 
62
+ ![unnamed.png](https://cdn-uploads.huggingface.co/production/uploads/62818ecf52815a0dc73c6f1e/JvIRYy9_5efTQqo0S8PcB.png)
63
 
64
  ### Framework versions
65