Update transformers snippet (#36)
Browse files- Update transformers snippet (bcf7628caaefc5f24a3ff692aac516277f82de02)
Co-authored-by: Pedro Cuenca <pcuenq@users.noreply.huggingface.co>
README.md
CHANGED
|
@@ -354,7 +354,12 @@ messages = [
|
|
| 354 |
]}
|
| 355 |
]
|
| 356 |
input_text = processor.apply_chat_template(messages, add_generation_prompt=True)
|
| 357 |
-
inputs = processor(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 358 |
|
| 359 |
output = model.generate(**inputs, max_new_tokens=30)
|
| 360 |
print(processor.decode(output[0]))
|
|
|
|
| 354 |
]}
|
| 355 |
]
|
| 356 |
input_text = processor.apply_chat_template(messages, add_generation_prompt=True)
|
| 357 |
+
inputs = processor(
|
| 358 |
+
image,
|
| 359 |
+
input_text,
|
| 360 |
+
add_special_tokens=False,
|
| 361 |
+
return_tensors="pt"
|
| 362 |
+
).to(model.device)
|
| 363 |
|
| 364 |
output = model.generate(**inputs, max_new_tokens=30)
|
| 365 |
print(processor.decode(output[0]))
|