Fix code typo in code examples
Browse filesHello 👋
Based on [this PR for 2.2B version](https://huggingface.co/HuggingFaceTB/SmolVLM2-2.2B-Instruct/discussions/9) and [this for 256M version](https://huggingface.co/HuggingFaceTB/SmolVLM2-256M-Video-Instruct/discussions/6).
I have included param `dtype=torch.bfloat16` when moving the processed inputs to CUDA (this is included in some examples, but not all).
This should avoid mismatched tensor types between model weights and inputs.
Sorry for spreading this over 3 PRs, I am not sure if there's a better way for such change🙂
Cheers,
Michal
README.md
CHANGED
|
@@ -127,7 +127,7 @@ inputs = processor.apply_chat_template(
|
|
| 127 |
tokenize=True,
|
| 128 |
return_dict=True,
|
| 129 |
return_tensors="pt",
|
| 130 |
-
).to(model.device)
|
| 131 |
|
| 132 |
generated_ids = model.generate(**inputs, do_sample=False, max_new_tokens=64)
|
| 133 |
generated_texts = processor.batch_decode(
|
|
@@ -163,7 +163,7 @@ inputs = processor.apply_chat_template(
|
|
| 163 |
tokenize=True,
|
| 164 |
return_dict=True,
|
| 165 |
return_tensors="pt",
|
| 166 |
-
).to(model.device)
|
| 167 |
|
| 168 |
generated_ids = model.generate(**inputs, do_sample=False, max_new_tokens=64)
|
| 169 |
generated_texts = processor.batch_decode(
|
|
|
|
| 127 |
tokenize=True,
|
| 128 |
return_dict=True,
|
| 129 |
return_tensors="pt",
|
| 130 |
+
).to(model.device, dtype=torch.bfloat16)
|
| 131 |
|
| 132 |
generated_ids = model.generate(**inputs, do_sample=False, max_new_tokens=64)
|
| 133 |
generated_texts = processor.batch_decode(
|
|
|
|
| 163 |
tokenize=True,
|
| 164 |
return_dict=True,
|
| 165 |
return_tensors="pt",
|
| 166 |
+
).to(model.device, dtype=torch.bfloat16)
|
| 167 |
|
| 168 |
generated_ids = model.generate(**inputs, do_sample=False, max_new_tokens=64)
|
| 169 |
generated_texts = processor.batch_decode(
|