TongkunGuan commited on
Commit
97be351
·
verified ·
1 Parent(s): cdb5235

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -77,9 +77,10 @@ def process_image(model, tokenizer, transform, device, check_type, image, text):
77
  if 'R50' in check_type:
78
  text_embeds = model.language_embedding(input_ids)
79
  else:
80
- text_embeds = model.tok_embeddings(input_ids)
81
 
82
  vit_embeds, size1 = model.forward_tokenocr(pixel_values.to(torch.bfloat16).to(device))
 
83
  print("vit_embeds",vit_embeds)
84
  print("vit_embeds,shape",vit_embeds.shape)
85
  print("target_ratio",target_ratio)
@@ -107,11 +108,9 @@ def process_image(model, tokenizer, transform, device, check_type, image, text):
107
 
108
  current_bpe = [tokenizer.decode([i]) for i in input_ids]
109
  # current_bpe[-1] = 'Input text'
110
- print("len1 ",len(current_vis))
111
- print("len2 ",len(current_bpe))
112
- print("current_bpe!!!!!!!!!!!!!!!!!!!",current_bpe)
113
 
114
- current_bpe.append(text)
115
 
116
  return image, current_vis, current_bpe
117
 
 
77
  if 'R50' in check_type:
78
  text_embeds = model.language_embedding(input_ids)
79
  else:
80
+ text_embeds = model.tok_embeddings(input_ids).clone()
81
 
82
  vit_embeds, size1 = model.forward_tokenocr(pixel_values.to(torch.bfloat16).to(device))
83
+
84
  print("vit_embeds",vit_embeds)
85
  print("vit_embeds,shape",vit_embeds.shape)
86
  print("target_ratio",target_ratio)
 
108
 
109
  current_bpe = [tokenizer.decode([i]) for i in input_ids]
110
  # current_bpe[-1] = 'Input text'
111
+
 
 
112
 
113
+ # current_bpe.append(text)
114
 
115
  return image, current_vis, current_bpe
116