gokaygokay commited on
Commit
738491f
1 Parent(s): ff2c266

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +2 -2
README.md CHANGED
@@ -25,12 +25,12 @@ model_id = "gokaygokay/paligemma-rich-captions"
25
  url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg?download=true"
26
  image = Image.open(requests.get(url, stream=True).raw)
27
 
28
- model = PaliGemmaForConditionalGeneration.from_pretrained(model_id).eval()
29
  processor = AutoProcessor.from_pretrained(model_id)
30
 
31
  ## prefix
32
  prompt = "caption en"
33
- model_inputs = processor(text=prompt, images=image, return_tensors="pt")
34
  input_len = model_inputs["input_ids"].shape[-1]
35
 
36
  with torch.inference_mode():
 
25
  url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/car.jpg?download=true"
26
  image = Image.open(requests.get(url, stream=True).raw)
27
 
28
+ model = PaliGemmaForConditionalGeneration.from_pretrained(model_id).to('cuda').eval()
29
  processor = AutoProcessor.from_pretrained(model_id)
30
 
31
  ## prefix
32
  prompt = "caption en"
33
+ model_inputs = processor(text=prompt, images=image, return_tensors="pt").to('cuda')
34
  input_len = model_inputs["input_ids"].shape[-1]
35
 
36
  with torch.inference_mode():