Qwen2-Audio-7B-DPO-CodeSwitch

128
by
myaccountfor
Audio Model
OTHER
7B params
New
128 downloads
Early-stage
Edge AI:
Mobile
Laptop
Server
16GB+ RAM
Mobile
Laptop
Server
Quick Summary

AI model with specialized capabilities.

Device Compatibility

Mobile
4-6GB RAM
Laptop
16GB RAM
Server
GPU
Minimum Recommended
7GB+ RAM

Code Examples

Usagepythontransformers
from transformers import Qwen2AudioForConditionalGeneration, AutoProcessor
import torch
import librosa

# Load model
model = Qwen2AudioForConditionalGeneration.from_pretrained(
    "myaccountfor/Qwen2-Audio-7B-DPO-CodeSwitch",
    torch_dtype=torch.bfloat16,
    device_map="auto",
    trust_remote_code=True
)
processor = AutoProcessor.from_pretrained(
    "myaccountfor/Qwen2-Audio-7B-DPO-CodeSwitch",
    trust_remote_code=True
)

model.eval()

# Load audio
audio, sr = librosa.load("path/to/audio.wav", sr=16000)

# Process inputs
conversation = [
    {"role": "user", "content": [
        {"type": "audio", "audio_url": "path/to/audio.wav"},
        {"type": "text", "text": "Please transcribe this audio."}
    ]}
]

text = processor.apply_chat_template(conversation, add_generation_prompt=True, tokenize=False)
audios = [audio]

inputs = processor(text=text, audios=audios, return_tensors="pt", padding=True)
inputs = {k: v.to(model.device) for k, v in inputs.items()}

# Generate
with torch.no_grad():
    outputs = model.generate(**inputs, max_new_tokens=256)
    transcription = processor.batch_decode(outputs, skip_special_tokens=True)[0]

print(transcription)

Deploy This Model

Production-ready deployment in minutes

Together.ai

Instant API access to this model

Fastest API

Production-ready inference API. Start free, scale to millions.

Try Free API

Replicate

One-click model deployment

Easiest Setup

Run models in the cloud with simple API. No DevOps required.

Deploy Now

Disclosure: We may earn a commission from these partners. This helps keep LLMYourWay free.