Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,199 +1,137 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
library_name: transformers
|
| 3 |
-
tags: []
|
| 4 |
---
|
| 5 |
|
| 6 |
-
#
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
##
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
### Results
|
| 128 |
-
|
| 129 |
-
[More Information Needed]
|
| 130 |
-
|
| 131 |
-
#### Summary
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
## Model Examination [optional]
|
| 136 |
-
|
| 137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 138 |
-
|
| 139 |
-
[More Information Needed]
|
| 140 |
-
|
| 141 |
-
## Environmental Impact
|
| 142 |
-
|
| 143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 144 |
-
|
| 145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 146 |
-
|
| 147 |
-
- **Hardware Type:** [More Information Needed]
|
| 148 |
-
- **Hours used:** [More Information Needed]
|
| 149 |
-
- **Cloud Provider:** [More Information Needed]
|
| 150 |
-
- **Compute Region:** [More Information Needed]
|
| 151 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 152 |
-
|
| 153 |
-
## Technical Specifications [optional]
|
| 154 |
-
|
| 155 |
-
### Model Architecture and Objective
|
| 156 |
-
|
| 157 |
-
[More Information Needed]
|
| 158 |
-
|
| 159 |
-
### Compute Infrastructure
|
| 160 |
-
|
| 161 |
-
[More Information Needed]
|
| 162 |
-
|
| 163 |
-
#### Hardware
|
| 164 |
-
|
| 165 |
-
[More Information Needed]
|
| 166 |
-
|
| 167 |
-
#### Software
|
| 168 |
-
|
| 169 |
-
[More Information Needed]
|
| 170 |
-
|
| 171 |
-
## Citation [optional]
|
| 172 |
-
|
| 173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 174 |
-
|
| 175 |
-
**BibTeX:**
|
| 176 |
-
|
| 177 |
-
[More Information Needed]
|
| 178 |
-
|
| 179 |
-
**APA:**
|
| 180 |
-
|
| 181 |
-
[More Information Needed]
|
| 182 |
-
|
| 183 |
-
## Glossary [optional]
|
| 184 |
-
|
| 185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 186 |
-
|
| 187 |
-
[More Information Needed]
|
| 188 |
-
|
| 189 |
-
## More Information [optional]
|
| 190 |
-
|
| 191 |
-
[More Information Needed]
|
| 192 |
-
|
| 193 |
-
## Model Card Authors [optional]
|
| 194 |
-
|
| 195 |
-
[More Information Needed]
|
| 196 |
-
|
| 197 |
-
## Model Card Contact
|
| 198 |
-
|
| 199 |
-
[More Information Needed]
|
|
|
|
| 1 |
---
|
| 2 |
+
license: mit
|
| 3 |
+
base_model: microsoft/VibeVoice-ASR
|
| 4 |
+
tags:
|
| 5 |
+
- automatic-speech-recognition
|
| 6 |
+
- vibevoice
|
| 7 |
+
- bitsandbytes
|
| 8 |
+
- 8-bit
|
| 9 |
+
- int8
|
| 10 |
+
- quantized
|
| 11 |
+
- diarization
|
| 12 |
+
- multilingual
|
| 13 |
+
pipeline_tag: automatic-speech-recognition
|
| 14 |
library_name: transformers
|
|
|
|
| 15 |
---
|
| 16 |
|
| 17 |
+
# VibeVoice-ASR — Selective INT8 Quantization
|
| 18 |
+
|
| 19 |
+
Selectively quantized version of [microsoft/VibeVoice-ASR](https://huggingface.co/microsoft/VibeVoice-ASR) for low-VRAM deployment.
|
| 20 |
+
|
| 21 |
+
**Only the Qwen2.5-7B LLM backbone is quantized to INT8.** Audio tokenizers, connectors, and lm_head remain in full BF16 precision — preserving diarization accuracy and transcription quality.
|
| 22 |
+
|
| 23 |
+
> ⚠️ This model uses the **standalone** `vibevoice` package (`pip install git+https://github.com/microsoft/VibeVoice.git`), NOT the HF-native `transformers >= 5.3.0` variant. It requires `transformers == 4.57.3`.
|
| 24 |
+
|
| 25 |
+
## Key details
|
| 26 |
+
|
| 27 |
+
| | |
|
| 28 |
+
|---|---|
|
| 29 |
+
| Base model | [microsoft/VibeVoice-ASR](https://huggingface.co/microsoft/VibeVoice-ASR) |
|
| 30 |
+
| Quantization | INT8 (bitsandbytes `Linear8bitLt`) |
|
| 31 |
+
| Modules quantized | `model.language_model.model.layers.*` (196 layers) |
|
| 32 |
+
| Modules in BF16 | `acoustic_tokenizer`, `semantic_tokenizer`, `acoustic_connector`, `semantic_connector`, `lm_head` (161 layers) |
|
| 33 |
+
| Model size | ~9.2 GB (down from 17.3 GB) |
|
| 34 |
+
| Peak VRAM | ~12.5 GB (including inference activations) |
|
| 35 |
+
| Transformers | == 4.57.3 |
|
| 36 |
+
| bitsandbytes | >= 0.48.1 |
|
| 37 |
+
|
| 38 |
+
## Why selective quantization?
|
| 39 |
+
|
| 40 |
+
Naive INT8 quantization of the entire model produces `[Unintelligible Speech]` — the model detects speech boundaries but cannot decode content. The acoustic and semantic tokenizer encoders process raw audio signals where quantization errors propagate catastrophically. The LLM backbone (Qwen2.5-7B) handles INT8 quantization gracefully.
|
| 41 |
+
|
| 42 |
+
**Critical discovery:** The standalone `vibevoice` package uses different module names than the HF-native variant. The correct skip list for the standalone model is:
|
| 43 |
+
|
| 44 |
+
| Standalone (this model) | HF-native (won't work here) |
|
| 45 |
+
|---|---|
|
| 46 |
+
| `acoustic_tokenizer` | `acoustic_tokenizer_encoder` |
|
| 47 |
+
| `semantic_tokenizer` | `semantic_tokenizer_encoder` |
|
| 48 |
+
| `acoustic_connector` | `acoustic_projection` |
|
| 49 |
+
| `semantic_connector` | `semantic_projection` |
|
| 50 |
+
|
| 51 |
+
Using the HF-native names with the standalone package silently quantizes audio-critical modules, producing garbage output.
|
| 52 |
+
|
| 53 |
+
## Usage
|
| 54 |
+
|
| 55 |
+
```python
|
| 56 |
+
import torch
|
| 57 |
+
from vibevoice.modular.modeling_vibevoice_asr import VibeVoiceASRForConditionalGeneration
|
| 58 |
+
from vibevoice.processor.vibevoice_asr_processor import VibeVoiceASRProcessor
|
| 59 |
+
|
| 60 |
+
model_id = "Dubedo/VibeVoice-ASR-INT8"
|
| 61 |
+
|
| 62 |
+
# Load processor (no preprocessor_config.json — default ratio=3200 is correct)
|
| 63 |
+
processor = VibeVoiceASRProcessor.from_pretrained(
|
| 64 |
+
model_id,
|
| 65 |
+
language_model_pretrained_name="Qwen/Qwen2.5-7B",
|
| 66 |
+
)
|
| 67 |
+
|
| 68 |
+
# Load quantized model
|
| 69 |
+
model = VibeVoiceASRForConditionalGeneration.from_pretrained(
|
| 70 |
+
model_id,
|
| 71 |
+
device_map="auto",
|
| 72 |
+
trust_remote_code=True,
|
| 73 |
+
)
|
| 74 |
+
model.eval()
|
| 75 |
+
|
| 76 |
+
# Transcribe
|
| 77 |
+
inputs = processor(
|
| 78 |
+
audio=["path/to/audio.wav"],
|
| 79 |
+
sampling_rate=None,
|
| 80 |
+
return_tensors="pt",
|
| 81 |
+
padding=True,
|
| 82 |
+
add_generation_prompt=True,
|
| 83 |
+
)
|
| 84 |
+
inputs = {k: v.to("cuda") if isinstance(v, torch.Tensor) else v for k, v in inputs.items()}
|
| 85 |
+
|
| 86 |
+
with torch.no_grad():
|
| 87 |
+
output_ids = model.generate(
|
| 88 |
+
**inputs,
|
| 89 |
+
max_new_tokens=32768,
|
| 90 |
+
pad_token_id=processor.pad_id,
|
| 91 |
+
eos_token_id=processor.tokenizer.eos_token_id,
|
| 92 |
+
do_sample=False,
|
| 93 |
+
)
|
| 94 |
+
|
| 95 |
+
input_length = inputs["input_ids"].shape[1]
|
| 96 |
+
generated_ids = output_ids[0, input_length:]
|
| 97 |
+
text = processor.decode(generated_ids, skip_special_tokens=True)
|
| 98 |
+
segments = processor.post_process_transcription(text)
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
## Quantization method
|
| 102 |
+
|
| 103 |
+
Quantized on NVIDIA L4 (22GB) using the standalone `vibevoice` package with `BitsAndBytesConfig`:
|
| 104 |
+
|
| 105 |
+
```python
|
| 106 |
+
from transformers import BitsAndBytesConfig
|
| 107 |
+
|
| 108 |
+
quantization_config = BitsAndBytesConfig(
|
| 109 |
+
load_in_8bit=True,
|
| 110 |
+
llm_int8_skip_modules=[
|
| 111 |
+
"acoustic_tokenizer",
|
| 112 |
+
"semantic_tokenizer",
|
| 113 |
+
"acoustic_connector",
|
| 114 |
+
"semantic_connector",
|
| 115 |
+
"lm_head",
|
| 116 |
+
],
|
| 117 |
+
)
|
| 118 |
+
|
| 119 |
+
model = VibeVoiceASRForConditionalGeneration.from_pretrained(
|
| 120 |
+
"microsoft/VibeVoice-ASR",
|
| 121 |
+
quantization_config=quantization_config,
|
| 122 |
+
torch_dtype=torch.bfloat16,
|
| 123 |
+
dtype=torch.bfloat16,
|
| 124 |
+
device_map="auto",
|
| 125 |
+
trust_remote_code=True,
|
| 126 |
+
)
|
| 127 |
+
```
|
| 128 |
+
|
| 129 |
+
## Important notes
|
| 130 |
+
|
| 131 |
+
- **Do NOT create a `preprocessor_config.json`** — the standalone processor's default fallback sets `speech_tok_compress_ratio=3200`, which is correct. Creating one with `ratio=320` causes a 10x mask shape mismatch and `IndexError`.
|
| 132 |
+
- **Requires `bitsandbytes >= 0.48.1`** — v0.48.0 has a confirmed critical bug breaking INT8 quantization.
|
| 133 |
+
- **INT8 models cannot be moved between CPU and GPU** — use delete+reload pattern for VRAM management.
|
| 134 |
+
|
| 135 |
+
## Acknowledgments
|
| 136 |
+
|
| 137 |
+
Based on [microsoft/VibeVoice-ASR](https://huggingface.co/microsoft/VibeVoice-ASR). Built for the [Dubedo](https://dubedo.com) AI video dubbing platform.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|