intfloat commited on
Commit
354f8f3
·
verified ·
1 Parent(s): 4b9f4ca

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +2 -2
README.md CHANGED
@@ -89,7 +89,7 @@ inputs = processor(text='Find me an everyday image that matches the given captio
89
  qry_output = last_pooling(model(**inputs, return_dict=True, output_hidden_states=True).hidden_states[-1], inputs['attention_mask'])
90
 
91
  string = '<|image|><|begin_of_text|> Represent the given image.'
92
- tgt_inputs = processor(text=string, images=[Image.open('figures/example.jpg')], return_tensors="pt").to("cuda")
93
  tgt_output = last_pooling(model(**tgt_inputs, return_dict=True, output_hidden_states=True).hidden_states[-1], tgt_inputs['attention_mask'])
94
  print(string, '=', compute_similarity(qry_output, tgt_output))
95
  ## <|image|><|begin_of_text|> Represent the given image. = tensor([[0.4219]], device='cuda:0', dtype=torch.bfloat16)
@@ -97,7 +97,7 @@ print(string, '=', compute_similarity(qry_output, tgt_output))
97
  inputs = processor(text='Find me an everyday image that matches the given caption: A cat and a tiger.', return_tensors="pt").to("cuda")
98
  qry_output = last_pooling(model(**inputs, return_dict=True, output_hidden_states=True).hidden_states[-1], inputs['attention_mask'])
99
  string = '<|image|><|begin_of_text|> Represent the given image.'
100
- tgt_inputs = processor(text=string, images=[Image.open('figures/example.jpg')], return_tensors="pt").to("cuda")
101
  tgt_output = last_pooling(model(**tgt_inputs, return_dict=True, output_hidden_states=True).hidden_states[-1], tgt_inputs['attention_mask'])
102
  print(string, '=', compute_similarity(qry_output, tgt_output))
103
  ## <|image|><|begin_of_text|> Represent the given image. = tensor([[0.3887]], device='cuda:0', dtype=torch.bfloat16)
 
89
  qry_output = last_pooling(model(**inputs, return_dict=True, output_hidden_states=True).hidden_states[-1], inputs['attention_mask'])
90
 
91
  string = '<|image|><|begin_of_text|> Represent the given image.'
92
+ tgt_inputs = processor(text=string, images=[image], return_tensors="pt").to("cuda")
93
  tgt_output = last_pooling(model(**tgt_inputs, return_dict=True, output_hidden_states=True).hidden_states[-1], tgt_inputs['attention_mask'])
94
  print(string, '=', compute_similarity(qry_output, tgt_output))
95
  ## <|image|><|begin_of_text|> Represent the given image. = tensor([[0.4219]], device='cuda:0', dtype=torch.bfloat16)
 
97
  inputs = processor(text='Find me an everyday image that matches the given caption: A cat and a tiger.', return_tensors="pt").to("cuda")
98
  qry_output = last_pooling(model(**inputs, return_dict=True, output_hidden_states=True).hidden_states[-1], inputs['attention_mask'])
99
  string = '<|image|><|begin_of_text|> Represent the given image.'
100
+ tgt_inputs = processor(text=string, images=[image], return_tensors="pt").to("cuda")
101
  tgt_output = last_pooling(model(**tgt_inputs, return_dict=True, output_hidden_states=True).hidden_states[-1], tgt_inputs['attention_mask'])
102
  print(string, '=', compute_similarity(qry_output, tgt_output))
103
  ## <|image|><|begin_of_text|> Represent the given image. = tensor([[0.3887]], device='cuda:0', dtype=torch.bfloat16)