JUNJIE99 commited on
Commit
01bd506
·
verified ·
1 Parent(s): 89dccbf

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,9 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ assets/cir_candi_2.png filter=lfs diff=lfs merge=lfs -text
37
+ assets/cir_query.png filter=lfs diff=lfs merge=lfs -text
38
+ assets/res-ft-mmeb.png filter=lfs diff=lfs merge=lfs -text
39
+ assets/res-scaling.png filter=lfs diff=lfs merge=lfs -text
40
+ assets/res-zs-cir.png filter=lfs diff=lfs merge=lfs -text
41
+ assets/res-zs-mmeb.png filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -86,11 +86,43 @@ with torch.no_grad():
86
  print(scores)
87
  ```
88
 
 
 
 
 
 
89
 
 
90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
 
92
- ### 2. MMRet-MLLM Models
93
- ```Will be released soon.```
94
 
95
  ## Model Performance
96
  ### Zero-Shot Composed Image Retrieval
 
86
  print(scores)
87
  ```
88
 
89
+ ### 2. MMRet-MLLM Models
90
+ ```python
91
+ import torch
92
+ from transformers import AutoModel
93
+ from PIL import Image
94
 
95
+ MODEL_NAME= "JUNJIE99/MMRet-MLLM-S1"
96
 
97
+ model = AutoModel.from_pretrained(MODEL_NAME, trust_remote_code=True)
98
+ model.eval()
99
+ model.cuda()
100
+
101
+ with torch.no_grad():
102
+ model.set_processor(MODEL_NAME)
103
+
104
+ query_inputs = model.data_process(
105
+ text="Make the background dark, as if the camera has taken the photo at night",
106
+ images="./assets/cir_query.png",
107
+ q_or_c="q",
108
+ task_instruction="Retrieve the target image that best meets the combined criteria by using both the provided image and the image retrieval instructions: "
109
+ )
110
+
111
+ candidate_inputs = model.data_process(
112
+ images=["./assets/cir_candi_1.png", "./assets/cir_candi_2.png"],
113
+ q_or_c="c",
114
+ )
115
+
116
+ query_embs = model(**query_inputs, output_hidden_states=True)[:, -1, :]
117
+ candi_embs = model(**candidate_inputs, output_hidden_states=True)[:, -1, :]
118
+
119
+ query_embs = torch.nn.functional.normalize(query_embs, dim=-1)
120
+ candi_embs = torch.nn.functional.normalize(candi_embs, dim=-1)
121
+
122
+ scores = torch.matmul(query_embs, candi_embs.T)
123
+ print(scores)
124
+ ```
125
 
 
 
126
 
127
  ## Model Performance
128
  ### Zero-Shot Composed Image Retrieval
assets/cir_candi_1.png ADDED
assets/cir_candi_2.png ADDED

Git LFS Details

  • SHA256: e3c4b3debd66d4789545d52bdd4c18bdbabaa072b69110ad08ff54b7b4503557
  • Pointer size: 131 Bytes
  • Size of remote file: 901 kB
assets/cir_query.png ADDED

Git LFS Details

  • SHA256: 42ad0e1200ba5c8767ea752f6358f6b51719674b064666b415b6ab0ea90ae62b
  • Pointer size: 131 Bytes
  • Size of remote file: 153 kB
assets/res-ft-mmeb.png ADDED

Git LFS Details

  • SHA256: 7011ea195b7e51c1e206c735072ec5d2acb96a5aa22fb7ff280523be21c2ba0f
  • Pointer size: 131 Bytes
  • Size of remote file: 208 kB
assets/res-scaling.png ADDED

Git LFS Details

  • SHA256: ad36953de26851baac1ac625467d87517d5151714104a92cc89f421d2c7326f0
  • Pointer size: 131 Bytes
  • Size of remote file: 144 kB
assets/res-zs-cir.png ADDED

Git LFS Details

  • SHA256: 61da2bc03b36c97c48d3e52bb96ccaecbb99d5d913847f665cbcd2d6a84435df
  • Pointer size: 131 Bytes
  • Size of remote file: 506 kB
assets/res-zs-mmeb.png ADDED

Git LFS Details

  • SHA256: 9e3fb656f33f9b2ff4290d9a900a6bcec40c3df97ff308cdfef82a62209bbf97
  • Pointer size: 131 Bytes
  • Size of remote file: 251 kB