Update README.md
Browse files
README.md
CHANGED
|
@@ -49,6 +49,27 @@ class AudioOnlyThinker(Qwen2_5OmniThinkerForConditionalGeneration):
|
|
| 49 |
return super().forward(*args, pixel_values=None, pixel_values_videos=None, **kwargs)
|
| 50 |
|
| 51 |
model = AudioOnlyThinker.from_pretrained("chunhuizng/AudioOnlyThinker")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
```
|
| 53 |
|
| 54 |
---
|
|
|
|
| 49 |
return super().forward(*args, pixel_values=None, pixel_values_videos=None, **kwargs)
|
| 50 |
|
| 51 |
model = AudioOnlyThinker.from_pretrained("chunhuizng/AudioOnlyThinker")
|
| 52 |
+
|
| 53 |
+
from audio_only_processor import AudioOnlyProcessor
|
| 54 |
+
|
| 55 |
+
processor = AudioOnlyProcessor.from_pretrained("chunhuizng/AudioOnlyThinker")
|
| 56 |
+
|
| 57 |
+
conversation = [
|
| 58 |
+
{
|
| 59 |
+
"role": "user",
|
| 60 |
+
"content": [
|
| 61 |
+
{"type": "audio", "path": "your_audio.wav"},
|
| 62 |
+
{"type": "text", "text": "What is being said in this audio?"}
|
| 63 |
+
]
|
| 64 |
+
}
|
| 65 |
+
]
|
| 66 |
+
|
| 67 |
+
inputs = processor.apply_chat_template(conversation, tokenize=True, return_tensors="pt")
|
| 68 |
+
inputs = {k: v.to(model.device) for k, v in inputs.items()}
|
| 69 |
+
outputs = model.generate(**inputs, max_new_tokens=128)
|
| 70 |
+
|
| 71 |
+
response = processor.batch_decode(outputs, skip_special_tokens=True)[0]
|
| 72 |
+
print(response)
|
| 73 |
```
|
| 74 |
|
| 75 |
---
|