Update README.md
Browse filesfix "device" and "pixel_values" not defined
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)
|
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, :]
|