Instructions to use Qwen/Qwen2-Audio-7B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Qwen/Qwen2-Audio-7B-Instruct with Transformers:
# Load model directly from transformers import AutoProcessor, AutoModelForSeq2SeqLM processor = AutoProcessor.from_pretrained("Qwen/Qwen2-Audio-7B-Instruct") model = AutoModelForSeq2SeqLM.from_pretrained("Qwen/Qwen2-Audio-7B-Instruct") - Notebooks
- Google Colab
- Kaggle
Move input_ids to cuda device
Browse filesThe original code does not work on ZeroGPU
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 |
```
|