cosmo3769 commited on
Commit
6e8c33b
·
verified ·
1 Parent(s): 06c116f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +22 -12
README.md CHANGED
@@ -9,26 +9,36 @@ model-index:
9
  results: []
10
  ---
11
 
12
- <!-- This model card has been generated automatically according to the information the Trainer had access to. You
13
- 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 +56,7 @@ The following hyperparameters were used during training:
46
 
47
  ### Training results
48
 
49
-
50
 
51
  ### Framework versions
52
 
 
9
  results: []
10
  ---
11
 
 
 
 
12
  # finetuned_paligemma_vqav2_small
13
 
14
+ 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
15
+ [vqav2 dataset](https://huggingface.co/datasets/merve/vqav2-small) by [Merve](https://huggingface.co/merve).
16
+
17
+ ## How to Use?
18
 
19
+ ```python
20
+ import torch
21
+ import requests
22
 
23
+ from PIL import Image
24
+ from transformers import AutoProcessor, PaliGemmaForConditionalGeneration
25
 
26
+ pretrained_model_id = "google/paligemma-3b-pt-224"
27
+ finetuned_model_id = "pyimagesearch/finetuned_paligemma_vqav2_small"
28
 
29
+ processor = AutoProcessor.from_pretrained(pretrained_model_id)
30
+ finetuned_model = PaliGemmaForConditionalGeneration.from_pretrained(finetuned_model_id)
31
 
32
+ prompt = "What is behind the cat?"
33
+ image_file = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/cat.png?download=true"
34
+ raw_image = Image.open(requests.get(image_file, stream=True).raw)
35
 
36
+ inputs = processor(raw_image.convert("RGB"), prompt, return_tensors="pt")
37
+ output = finetuned_model.generate(**inputs, max_new_tokens=20)
38
 
39
+ print(processor.decode(output[0], skip_special_tokens=True)[len(prompt):])
40
+ # gramophone
41
+ ```
42
 
43
  ### Training hyperparameters
44
 
 
56
 
57
  ### Training results
58
 
59
+ ![unnamed.png](https://cdn-uploads.huggingface.co/production/uploads/62818ecf52815a0dc73c6f1e/JvIRYy9_5efTQqo0S8PcB.png)
60
 
61
  ### Framework versions
62