Update app.py
Browse files
app.py
CHANGED
@@ -373,6 +373,7 @@ def construct_sample(image: Image, instruction: str, transform):
|
|
373 |
|
374 |
instruction = encode_text(' {}'.format(instruction.lower().strip()), append_bos=True, append_eos=True).unsqueeze(0)
|
375 |
instruction_length = torch.LongTensor([s.ne(pad_idx).long().sum() for s in instruction])
|
|
|
376 |
sample = {
|
377 |
"id": np.array(['42']),
|
378 |
"net_input": {
|
@@ -380,7 +381,9 @@ def construct_sample(image: Image, instruction: str, transform):
|
|
380 |
"src_lengths": instruction_length,
|
381 |
"patch_images": patch_image,
|
382 |
"patch_masks": patch_mask,
|
383 |
-
|
|
|
|
|
384 |
}
|
385 |
return sample
|
386 |
|
|
|
373 |
|
374 |
instruction = encode_text(' {}'.format(instruction.lower().strip()), append_bos=True, append_eos=True).unsqueeze(0)
|
375 |
instruction_length = torch.LongTensor([s.ne(pad_idx).long().sum() for s in instruction])
|
376 |
+
ref_dict = np.array([{'yes': 1.0}]) # just placeholder
|
377 |
sample = {
|
378 |
"id": np.array(['42']),
|
379 |
"net_input": {
|
|
|
381 |
"src_lengths": instruction_length,
|
382 |
"patch_images": patch_image,
|
383 |
"patch_masks": patch_mask,
|
384 |
+
|
385 |
+
},
|
386 |
+
"ref_dict": ref_dict,
|
387 |
}
|
388 |
return sample
|
389 |
|