Wa2erGo commited on
Commit
80506f6
1 Parent(s): 9507e9c

Update README.md

Browse files

fix "device" and "pixel_values" not defined

Files changed (1) hide show
  1. README.md +2 -2
README.md CHANGED
@@ -42,9 +42,9 @@ inferred_token = [text]
42
  with torch.no_grad():
43
  for i in range(tl):
44
  encoded = processor.tokenizer(inferred_token)
45
- input_ids = torch.tensor(encoded.input_ids).to(device)
46
  encoded = encoded["input_ids"][0][1:-1]
47
- outputs = model(input_ids=input_ids, pixel_values=pixel_values)
48
  mlm_logits = outputs.logits[0] # shape (seq_len, vocab_size)
49
  # only take into account text features (minus CLS and SEP token)
50
  mlm_logits = mlm_logits[1 : input_ids.shape[1] - 1, :]
 
42
  with torch.no_grad():
43
  for i in range(tl):
44
  encoded = processor.tokenizer(inferred_token)
45
+ input_ids = torch.tensor(encoded.input_ids)
46
  encoded = encoded["input_ids"][0][1:-1]
47
+ outputs = model(input_ids=input_ids, pixel_values=encoding.pixel_values)
48
  mlm_logits = outputs.logits[0] # shape (seq_len, vocab_size)
49
  # only take into account text features (minus CLS and SEP token)
50
  mlm_logits = mlm_logits[1 : input_ids.shape[1] - 1, :]