Text Generation
Transformers
English
phi3_v
Embedding
custom_code
wenhu commited on
Commit
db76f1d
1 Parent(s): 10b6452

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +13 -4
README.md CHANGED
@@ -53,11 +53,9 @@ from PIL import Image
53
  import numpy as np
54
 
55
  model_args = ModelArguments(
56
- model_name='microsoft/Phi-3.5-vision-instruct',
57
  pooling='last',
58
- normalize=True,
59
- lora=True,
60
- checkpoint_path='TIGER-Lab/VLM2Vec-LoRA')
61
 
62
  model = MMEBModel.load(model_args)
63
  model.eval()
@@ -99,6 +97,17 @@ inputs = {key: value.to('cuda') for key, value in inputs.items()}
99
  tgt_output = model(tgt=inputs)["tgt_reps"]
100
  print(string, '=', model.compute_similarity(qry_output, tgt_output))
101
  ## <|image_1|> Represent the given image. = tensor([[0.3105]], device='cuda:0', dtype=torch.bfloat16)
 
 
 
 
 
 
 
 
 
 
 
102
  ```
103
 
104
  ## Citation
 
53
  import numpy as np
54
 
55
  model_args = ModelArguments(
56
+ model_name='TIGER-Lab/VLM2Vec-Full',
57
  pooling='last',
58
+ normalize=True)
 
 
59
 
60
  model = MMEBModel.load(model_args)
61
  model.eval()
 
97
  tgt_output = model(tgt=inputs)["tgt_reps"]
98
  print(string, '=', model.compute_similarity(qry_output, tgt_output))
99
  ## <|image_1|> Represent the given image. = tensor([[0.3105]], device='cuda:0', dtype=torch.bfloat16)
100
+
101
+ inputs = processor('Find me an everyday image that matches the given caption: A cat and a tiger.',)
102
+ inputs = {key: value.to('cuda') for key, value in inputs.items()}
103
+ qry_output = model(qry=inputs)["qry_reps"]
104
+
105
+ string = '<|image_1|> Represent the given image.'
106
+ inputs = processor(string, [Image.open('figures/example.jpg')])
107
+ inputs = {key: value.to('cuda') for key, value in inputs.items()}
108
+ tgt_output = model(tgt=inputs)["tgt_reps"]
109
+ print(string, '=', model.compute_similarity(qry_output, tgt_output))
110
+ ## <|image_1|> Represent the given image. = tensor([[0.2158]], device='cuda:0', dtype=torch.bfloat16)
111
  ```
112
 
113
  ## Citation