Move input_ids to cuda device
#9
by
freddyaboulton
HF Staff
- opened
README.md
CHANGED
|
@@ -65,10 +65,11 @@ for message in conversation:
|
|
| 65 |
)
|
| 66 |
|
| 67 |
inputs = processor(text=text, audios=audios, return_tensors="pt", padding=True)
|
| 68 |
-
inputs
|
|
|
|
| 69 |
|
| 70 |
generate_ids = model.generate(**inputs, max_length=256)
|
| 71 |
-
generate_ids = generate_ids[:, inputs
|
| 72 |
|
| 73 |
response = processor.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
|
| 74 |
```
|
|
|
|
| 65 |
)
|
| 66 |
|
| 67 |
inputs = processor(text=text, audios=audios, return_tensors="pt", padding=True)
|
| 68 |
+
inputs = dict(**inputs)
|
| 69 |
+
inputs["input_ids"] = inputs["input_ids"].to("cuda")
|
| 70 |
|
| 71 |
generate_ids = model.generate(**inputs, max_length=256)
|
| 72 |
+
generate_ids = generate_ids[:, inputs["input_ids"].size(1):]
|
| 73 |
|
| 74 |
response = processor.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
|
| 75 |
```
|