howard-hou commited on
Commit
a9b31ad
1 Parent(s): c9b06c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -33,7 +33,7 @@ image_processor = CLIPImageProcessor.from_pretrained(vision_tower_name)
33
  ##########################################################################
34
  def generate_prompt(instruction):
35
  instruction = instruction.strip().replace('\r\n','\n').replace('\n\n','\n')
36
- return f"\n{instruction}\n\nAssistant:"
37
 
38
  def generate(
39
  ctx,
@@ -59,7 +59,8 @@ def generate(
59
  input_ids = pipeline.encode(ctx)
60
  print(input_ids)
61
  text_embs = model.w['emb.weight'][input_ids]
62
- input_embs = torch.cat((image_features, text_embs), dim=0)[-ctx_limit:]
 
63
  out, state = model.forward(embs=input_embs, state=None)
64
  else:
65
  input_ids = [token]
 
33
  ##########################################################################
34
  def generate_prompt(instruction):
35
  instruction = instruction.strip().replace('\r\n','\n').replace('\n\n','\n')
36
+ return f"{instruction}\n\nAssistant:"
37
 
38
  def generate(
39
  ctx,
 
59
  input_ids = pipeline.encode(ctx)
60
  print(input_ids)
61
  text_embs = model.w['emb.weight'][input_ids]
62
+ input_embs = torch.cat((image_features, text_embs), dim=0)
63
+ print(input_embs.shape)
64
  out, state = model.forward(embs=input_embs, state=None)
65
  else:
66
  input_ids = [token]