Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# wav2vec2-large-xlsr-53-portuguese
|
| 2 |
+
|
| 3 |
+
GGUF quantizations of [jonatasgrosman/wav2vec2-large-xlsr-53-portuguese](https://huggingface.co/jonatasgrosman/wav2vec2-large-xlsr-53-portuguese) for use with [wav2vec2.cpp](https://github.com/liodon-ai/wav2vec2.cpp).
|
| 4 |
+
|
| 5 |
+
## Files
|
| 6 |
+
|
| 7 |
+
| Filename | Quant | Size | Precision |
|
| 8 |
+
|----------|-------|------|-----------|
|
| 9 |
+
| `model_f16.gguf` | F16 | 631 MB | ~fp16 (near-lossless) |
|
| 10 |
+
| `model_q8_0.gguf` | Q8_0 | 373 MB | 8-bit quantized linear layers |
|
| 11 |
+
| `model_q4_0.gguf` | Q4_0 | 222 MB | 4-bit quantized linear layers |
|
| 12 |
+
|
| 13 |
+
## Parity vs HuggingFace Reference
|
| 14 |
+
|
| 15 |
+
Tested on 10 audio samples from FLEURS pt_br.
|
| 16 |
+
|
| 17 |
+
| Quant | Mean CER (vs HF) | Mean WER (vs HF) | Status |
|
| 18 |
+
|-------|-----------------|-----------------|--------|
|
| 19 |
+
| F16 | 0.00% | 0.00% | PASS |
|
| 20 |
+
| Q8_0 | 0.11% | 1.39% | PASS |
|
| 21 |
+
| Q4_0 | 0.81% | 5.87% | PASS |
|
| 22 |
+
|
| 23 |
+
CER/WER measured against HF model output (not ground truth) to isolate quantization error.
|
| 24 |
+
|
| 25 |
+
## Usage
|
| 26 |
+
|
| 27 |
+
### C++ CLI
|
| 28 |
+
|
| 29 |
+
```bash
|
| 30 |
+
# Clone and build
|
| 31 |
+
git clone --recursive https://github.com/liodon-ai/wav2vec2.cpp
|
| 32 |
+
cd wav2vec2.cpp && mkdir build && cd build && cmake .. && make -j
|
| 33 |
+
|
| 34 |
+
# Download and run
|
| 35 |
+
huggingface-cli download liodon-ai/wav2vec2-large-xlsr-53-portuguese-GGUF model_q8_0.gguf --local-dir .
|
| 36 |
+
./wav2vec2-cli -m model_q8_0.gguf -f audio.wav
|
| 37 |
+
|
| 38 |
+
# With word timestamps
|
| 39 |
+
./wav2vec2-cli -m model_q8_0.gguf -f audio.wav -w
|
| 40 |
+
|
| 41 |
+
# SRT subtitle output
|
| 42 |
+
./wav2vec2-cli -m model_q8_0.gguf -f audio.wav --format srt > output.srt
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
### Python (via subprocess)
|
| 46 |
+
|
| 47 |
+
```python
|
| 48 |
+
import subprocess, json
|
| 49 |
+
result = subprocess.run(
|
| 50 |
+
['./wav2vec2-cli', '-m', 'model_q8_0.gguf', '-f', 'audio.wav', '--format', 'json'],
|
| 51 |
+
capture_output=True, text=True
|
| 52 |
+
)
|
| 53 |
+
data = json.loads(result.stdout)
|
| 54 |
+
print(data['transcript'])
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
## Source Model
|
| 58 |
+
|
| 59 |
+
- **Original**: [jonatasgrosman/wav2vec2-large-xlsr-53-portuguese](https://huggingface.co/jonatasgrosman/wav2vec2-large-xlsr-53-portuguese)
|
| 60 |
+
- **Architecture**: XLS-R
|
| 61 |
+
- **Language**: pt
|
| 62 |
+
- **Task**: Automatic Speech Recognition
|
| 63 |
+
|
| 64 |
+
## Conversion
|
| 65 |
+
|
| 66 |
+
Converted using [wav2vec2.cpp](https://github.com/liodon-ai/wav2vec2.cpp) `scripts/convert_to_gguf.py`.
|
| 67 |
+
|
| 68 |
+
```bash
|
| 69 |
+
python scripts/convert_to_gguf.py jonatasgrosman/wav2vec2-large-xlsr-53-portuguese model_f16.gguf --dtype f16
|
| 70 |
+
python scripts/convert_to_gguf.py jonatasgrosman/wav2vec2-large-xlsr-53-portuguese model_q8_0.gguf --dtype q8_0
|
| 71 |
+
python scripts/convert_to_gguf.py jonatasgrosman/wav2vec2-large-xlsr-53-portuguese model_q4_0.gguf --dtype q4_0
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
## License
|
| 75 |
+
|
| 76 |
+
Follows the license of the [source model](https://huggingface.co/jonatasgrosman/wav2vec2-large-xlsr-53-portuguese/blob/main/LICENSE).
|