Downloads · 30 days
8
1% of all-time downloads
DanJZY/Qwen2-VL-7B-Speech-LoRA
Qwen2-VL-7B-Speech-LoRA is a automatic speech recognition model from DanJZY. Use it when you need speech turned into text. It is set up for peft. The card lists the license as apache-2.0.
This repository contains LoRA adapters only (~700 MB), NOT the full model.
Downloads · 30 days
8
1% of all-time downloads
All-time downloads
972
Public
Repo size
1.4 GB
Likes
0
Public
Click a slice to open those files.
.safetensors681 MB · 98%
From the Hugging Face model README
This repository contains LoRA adapters only (~700 MB), NOT the full model.
You must load the base model DanJZY/Qwen2-VL-7B-Speech first, then apply these adapters on top.
modules_to_save)import torch
from transformers import Qwen2VLForConditionalGeneration, Qwen2VLProcessor
from peft import PeftModel
from qwen_vl_utils import process_vision_info
# Step 1: Load the base model (required)
base_model = Qwen2VLForConditionalGeneration.from_pretrained(
"DanJZY/Qwen2-VL-7B-Speech",
torch_dtype=torch.bfloat16,
device_map="cuda",
)
# Step 2: Apply LoRA adapters from this repo
model = PeftModel.from_pretrained(base_model, "DanJZY/Qwen2-VL-7B-Speech-LoRA")
model.eval()
processor = Qwen2VLProcessor.from_pretrained("DanJZY/Qwen2-VL-7B-Speech")
# Step 3: Transcribe audio
messages = [
{"role": "user", "content": [
{"type": "audio", "audio": "path/to/audio.wav"},
{"type": "text", "text": "Transcribe this audio."},
]},
]
image_inputs, video_inputs, audio_inputs = process_vision_info(messages)
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
batch = processor(text=[text], audios=audio_inputs, return_tensors="pt", padding=True)
batch = {k: v.to(model.device) if isinstance(v, torch.Tensor) else v for k, v in batch.items()}
with torch.inference_mode():
output_ids = model.generate(
**batch, max_new_tokens=256, num_beams=2,
do_sample=False, repetition_penalty=1.1,
)
prompt_len = batch["input_ids"].shape[1]
print(processor.batch_decode(output_ids[:, prompt_len:], skip_special_tokens=True)[0])
Evaluated on speechbrain/LargeScaleASR test set (8,087 samples):
| Model | WER | CER |
|---|---|---|
| Base model only (DanJZY/Qwen2-VL-7B-Speech) | 12.89% | 7.43% |
| + LoRA adapters (this repo) | 8.67% | 4.75% |
+ LoRA + decoding fixes (repetition_penalty=1.1, num_beams=2) | 7.90% | 4.25% |
small split (~107K training samples, 3 epochs)Requires our forked transformers with audio support. See the training repository for setup instructions.