Automatic Speech Recognition
Transformers
Safetensors
Arabic
Moroccan Arabic
qwen3_asr
darija
fihria
moroccan-arabic
qwen3-asr
code-switching
Instructions to use fihriaLab/fihrIA-ASR-0.6B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use fihriaLab/fihrIA-ASR-0.6B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="fihriaLab/fihrIA-ASR-0.6B")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("fihriaLab/fihrIA-ASR-0.6B") model = AutoModelForMultimodalLM.from_pretrained("fihriaLab/fihrIA-ASR-0.6B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Publish fihriaLab/fihrIA-ASR-0.6B safetensors weights and model card
Browse files- .gitattributes +2 -0
- LICENSE +202 -0
- README.md +77 -166
- asr_guards.py +0 -287
- chat_template.json +1 -0
- config.json +235 -0
- fihria-asr-0.6b-Q4_K_M.gguf +0 -3
- generation_config.json +9 -0
- merges.txt +0 -0
- mmproj-fihria-asr-0.6b-BF16.gguf +0 -3
- fihria-asr-0.6b-BF16.gguf → model.safetensors +2 -2
- preprocessor_config.json +14 -0
- special_tokens_map.json +19 -0
- tokenizer.json +0 -0
- tokenizer_config.json +518 -0
- transcribe.py +0 -197
- vocab.json +0 -0
.gitattributes
CHANGED
|
@@ -1 +1,3 @@
|
|
| 1 |
*.gguf filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 1 |
*.gguf filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
Apache License
|
| 3 |
+
Version 2.0, January 2004
|
| 4 |
+
http://www.apache.org/licenses/
|
| 5 |
+
|
| 6 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 7 |
+
|
| 8 |
+
1. Definitions.
|
| 9 |
+
|
| 10 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 11 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 12 |
+
|
| 13 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 14 |
+
the copyright owner that is granting the License.
|
| 15 |
+
|
| 16 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 17 |
+
other entities that control, are controlled by, or are under common
|
| 18 |
+
control with that entity. For the purposes of this definition,
|
| 19 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 20 |
+
direction or management of such entity, whether by contract or
|
| 21 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 22 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 23 |
+
|
| 24 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 25 |
+
exercising permissions granted by this License.
|
| 26 |
+
|
| 27 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 28 |
+
including but not limited to software source code, documentation
|
| 29 |
+
source, and configuration files.
|
| 30 |
+
|
| 31 |
+
"Object" form shall mean any form resulting from mechanical
|
| 32 |
+
transformation or translation of a Source form, including but
|
| 33 |
+
not limited to compiled object code, generated documentation,
|
| 34 |
+
and conversions to other media types.
|
| 35 |
+
|
| 36 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 37 |
+
Object form, made available under the License, as indicated by a
|
| 38 |
+
copyright notice that is included in or attached to the work
|
| 39 |
+
(an example is provided in the Appendix below).
|
| 40 |
+
|
| 41 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 42 |
+
form, that is based on (or derived from) the Work and for which the
|
| 43 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 44 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 45 |
+
of this License, Derivative Works shall not include works that remain
|
| 46 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 47 |
+
the Work and Derivative Works thereof.
|
| 48 |
+
|
| 49 |
+
"Contribution" shall mean any work of authorship, including
|
| 50 |
+
the original version of the Work and any modifications or additions
|
| 51 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 52 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 53 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 54 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 55 |
+
means any form of electronic, verbal, or written communication sent
|
| 56 |
+
to the Licensor or its representatives, including but not limited to
|
| 57 |
+
communication on electronic mailing lists, source code control systems,
|
| 58 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 59 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 60 |
+
excluding communication that is conspicuously marked or otherwise
|
| 61 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 62 |
+
|
| 63 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 64 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 65 |
+
subsequently incorporated within the Work.
|
| 66 |
+
|
| 67 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 68 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 69 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 70 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 71 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 72 |
+
Work and such Derivative Works in Source or Object form.
|
| 73 |
+
|
| 74 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 75 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 76 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 77 |
+
(except as stated in this section) patent license to make, have made,
|
| 78 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 79 |
+
where such license applies only to those patent claims licensable
|
| 80 |
+
by such Contributor that are necessarily infringed by their
|
| 81 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 82 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 83 |
+
institute patent litigation against any entity (including a
|
| 84 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 85 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 86 |
+
or contributory patent infringement, then any patent licenses
|
| 87 |
+
granted to You under this License for that Work shall terminate
|
| 88 |
+
as of the date such litigation is filed.
|
| 89 |
+
|
| 90 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 91 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 92 |
+
modifications, and in Source or Object form, provided that You
|
| 93 |
+
meet the following conditions:
|
| 94 |
+
|
| 95 |
+
(a) You must give any other recipients of the Work or
|
| 96 |
+
Derivative Works a copy of this License; and
|
| 97 |
+
|
| 98 |
+
(b) You must cause any modified files to carry prominent notices
|
| 99 |
+
stating that You changed the files; and
|
| 100 |
+
|
| 101 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 102 |
+
that You distribute, all copyright, patent, trademark, and
|
| 103 |
+
attribution notices from the Source form of the Work,
|
| 104 |
+
excluding those notices that do not pertain to any part of
|
| 105 |
+
the Derivative Works; and
|
| 106 |
+
|
| 107 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 108 |
+
distribution, then any Derivative Works that You distribute must
|
| 109 |
+
include a readable copy of the attribution notices contained
|
| 110 |
+
within such NOTICE file, excluding those notices that do not
|
| 111 |
+
pertain to any part of the Derivative Works, in at least one
|
| 112 |
+
of the following places: within a NOTICE text file distributed
|
| 113 |
+
as part of the Derivative Works; within the Source form or
|
| 114 |
+
documentation, if provided along with the Derivative Works; or,
|
| 115 |
+
within a display generated by the Derivative Works, if and
|
| 116 |
+
wherever such third-party notices normally appear. The contents
|
| 117 |
+
of the NOTICE file are for informational purposes only and
|
| 118 |
+
do not modify the License. You may add Your own attribution
|
| 119 |
+
notices within Derivative Works that You distribute, alongside
|
| 120 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 121 |
+
that such additional attribution notices cannot be construed
|
| 122 |
+
as modifying the License.
|
| 123 |
+
|
| 124 |
+
You may add Your own copyright statement to Your modifications and
|
| 125 |
+
may provide additional or different license terms and conditions
|
| 126 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 127 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 128 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 129 |
+
the conditions stated in this License.
|
| 130 |
+
|
| 131 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 132 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 133 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 134 |
+
this License, without any additional terms or conditions.
|
| 135 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 136 |
+
the terms of any separate license agreement you may have executed
|
| 137 |
+
with Licensor regarding such Contributions.
|
| 138 |
+
|
| 139 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 140 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 141 |
+
except as required for reasonable and customary use in describing the
|
| 142 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 143 |
+
|
| 144 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 145 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 146 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 147 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 148 |
+
implied, including, without limitation, any warranties or conditions
|
| 149 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 150 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 151 |
+
appropriateness of using or redistributing the Work and assume any
|
| 152 |
+
risks associated with Your exercise of permissions under this License.
|
| 153 |
+
|
| 154 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 155 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 156 |
+
unless required by applicable law (such as deliberate and grossly
|
| 157 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 158 |
+
liable to You for damages, including any direct, indirect, special,
|
| 159 |
+
incidental, or consequential damages of any character arising as a
|
| 160 |
+
result of this License or out of the use or inability to use the
|
| 161 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 162 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 163 |
+
other commercial damages or losses), even if such Contributor
|
| 164 |
+
has been advised of the possibility of such damages.
|
| 165 |
+
|
| 166 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 167 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 168 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 169 |
+
or other liability obligations and/or rights consistent with this
|
| 170 |
+
License. However, in accepting such obligations, You may act only
|
| 171 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 172 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 173 |
+
defend, and hold each Contributor harmless for any liability
|
| 174 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 175 |
+
of your accepting any such warranty or additional liability.
|
| 176 |
+
|
| 177 |
+
END OF TERMS AND CONDITIONS
|
| 178 |
+
|
| 179 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 180 |
+
|
| 181 |
+
To apply the Apache License to your work, attach the following
|
| 182 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 183 |
+
replaced with your own identifying information. (Don't include
|
| 184 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 185 |
+
comment syntax for the file format. We also recommend that a
|
| 186 |
+
file or class name and description of purpose be included on the
|
| 187 |
+
same "printed page" as the copyright notice for easier
|
| 188 |
+
identification within third-party archives.
|
| 189 |
+
|
| 190 |
+
Copyright [yyyy] [name of copyright owner]
|
| 191 |
+
|
| 192 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 193 |
+
you may not use this file except in compliance with the License.
|
| 194 |
+
You may obtain a copy of the License at
|
| 195 |
+
|
| 196 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 197 |
+
|
| 198 |
+
Unless required by applicable law or agreed to in writing, software
|
| 199 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 200 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 201 |
+
See the License for the specific language governing permissions and
|
| 202 |
+
limitations under the License.
|
README.md
CHANGED
|
@@ -4,16 +4,15 @@ language:
|
|
| 4 |
- ar
|
| 5 |
- ary
|
| 6 |
pipeline_tag: automatic-speech-recognition
|
| 7 |
-
library_name:
|
|
|
|
| 8 |
tags:
|
| 9 |
- automatic-speech-recognition
|
| 10 |
- darija
|
| 11 |
- fihria
|
| 12 |
- moroccan-arabic
|
| 13 |
- qwen3-asr
|
| 14 |
-
-
|
| 15 |
-
- gguf
|
| 16 |
-
- mtmd
|
| 17 |
- code-switching
|
| 18 |
---
|
| 19 |
|
|
@@ -35,15 +34,16 @@ unified protocol, the family is built for robust, real-world transcription:
|
|
| 35 |
|
| 36 |
## Technical & deployment details
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
`mmproj` audio projector.
|
| 42 |
|
| 43 |
-
Repositories
|
| 44 |
|
| 45 |
-
- **0.6B
|
| 46 |
-
- **1.7B
|
|
|
|
|
|
|
| 47 |
|
| 48 |
## Results
|
| 49 |
|
|
@@ -72,129 +72,74 @@ the model, the data, or a collaboration: **contact@fihria.ma**.
|
|
| 72 |
|
| 73 |
## Files
|
| 74 |
|
| 75 |
-
Each repository carries its own size
|
| 76 |
|
| 77 |
-
| File | Size | Description |
|
| 78 |
|---|---|---|
|
| 79 |
-
| `
|
| 80 |
-
| `
|
| 81 |
-
| `
|
| 82 |
-
| `fihria-asr-1.7b-Q4_K_M.gguf` | 1,000 MB | 1.7B language model, 4-bit. |
|
| 83 |
-
| `fihria-asr-1.7b-BF16.gguf` | 3,188 MB | 1.7B language model, full precision. |
|
| 84 |
-
| `mmproj-fihria-asr-1.7b-BF16.gguf` | 642 MB | 1.7B audio projector. **Always required.** |
|
| 85 |
-
|
| 86 |
-
Always pair the language model with the `mmproj` file.
|
| 87 |
-
|
| 88 |
-
Keep the `mmproj` in BF16. A quantized audio encoder saves little memory and has not been
|
| 89 |
-
validated for this model.
|
| 90 |
-
|
| 91 |
-
## Required llama.cpp version
|
| 92 |
-
|
| 93 |
-
> [!IMPORTANT]
|
| 94 |
-
> ⚠️ Use llama.cpp **build 9199 (`39cf5d619`, 2026-05-17)** or newer.
|
| 95 |
-
|
| 96 |
-
Older builds load these files without error and produce fluent-looking output with
|
| 97 |
-
**silently wrong words**.
|
| 98 |
-
|
| 99 |
-
```bash
|
| 100 |
-
git clone https://github.com/ggml-org/llama.cpp
|
| 101 |
-
cd llama.cpp
|
| 102 |
-
git checkout 39cf5d619 # or any newer commit
|
| 103 |
-
cmake -B build -DCMAKE_BUILD_TYPE=Release
|
| 104 |
-
cmake --build build -j --target llama-server llama-mtmd-cli
|
| 105 |
-
./build/bin/llama-server --version # expect: 9199 (39cf5d619) or newer
|
| 106 |
-
```
|
| 107 |
-
|
| 108 |
-
A CPU-only build is fine; the reference results below were produced on CPU.
|
| 109 |
|
| 110 |
## Quick start
|
| 111 |
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
```bash
|
| 115 |
-
# 0.6B
|
| 116 |
-
hf download fihriaLab/fihrIA-ASR-0.6B \
|
| 117 |
-
fihria-asr-0.6b-Q4_K_M.gguf \
|
| 118 |
-
mmproj-fihria-asr-0.6b-BF16.gguf \
|
| 119 |
-
--local-dir ./fihria-asr-0.6b
|
| 120 |
-
|
| 121 |
-
# 1.7B
|
| 122 |
-
hf download fihriaLab/fihrIA-ASR-1.7B \
|
| 123 |
-
fihria-asr-1.7b-Q4_K_M.gguf \
|
| 124 |
-
mmproj-fihria-asr-1.7b-BF16.gguf \
|
| 125 |
-
--local-dir ./fihria-asr-1.7b
|
| 126 |
-
```
|
| 127 |
-
|
| 128 |
-
The commands below use the 0.6B filenames; swap `0.6b` for `1.7b` to run the 1.7B.
|
| 129 |
-
|
| 130 |
-
### One-shot transcription
|
| 131 |
-
|
| 132 |
-
```bash
|
| 133 |
-
llama-mtmd-cli \
|
| 134 |
-
-m fihria-asr-0.6b-Q4_K_M.gguf \
|
| 135 |
-
--mmproj mmproj-fihria-asr-0.6b-BF16.gguf \
|
| 136 |
-
--audio sample.wav \
|
| 137 |
-
-p "Transcribe the speech in the original language." \
|
| 138 |
-
--jinja -c 8192 -n 512 --temp 0
|
| 139 |
-
```
|
| 140 |
-
|
| 141 |
-
### Server
|
| 142 |
-
|
| 143 |
-
```bash
|
| 144 |
-
llama-server \
|
| 145 |
-
-m fihria-asr-0.6b-Q4_K_M.gguf \
|
| 146 |
-
--mmproj mmproj-fihria-asr-0.6b-BF16.gguf \
|
| 147 |
-
--no-mmproj-offload -ngl 0 -c 8192 \
|
| 148 |
-
--host 127.0.0.1 --port 8080
|
| 149 |
-
```
|
| 150 |
-
|
| 151 |
-
Then send audio as base64 through the OpenAI-compatible endpoint. A ready-made client is
|
| 152 |
-
included as `transcribe.py`:
|
| 153 |
|
| 154 |
```bash
|
| 155 |
-
|
| 156 |
-
|
|
|
|
| 157 |
```
|
| 158 |
|
| 159 |
-
|
| 160 |
|
| 161 |
-
```
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
```
|
| 173 |
|
| 174 |
-
##
|
| 175 |
-
|
| 176 |
-
Send the **audio first, then the text prompt**:
|
| 177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
```
|
| 179 |
-
Transcribe the speech in the original language.
|
| 180 |
-
```
|
| 181 |
-
|
| 182 |
-
That is the instruction the model was trained with, so keep it. Use `temperature = 0` for
|
| 183 |
-
reproducible output. No system message is needed.
|
| 184 |
|
| 185 |
## Output format
|
| 186 |
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
<div dir="rtl" lang="ar">language Darijaالتلفون ديالي طاح وتهرس ليه l'écran</div>
|
| 191 |
-
|
| 192 |
-
That is what build 9199 returns from the `llama-server` chat endpoint. `llama-mtmd-cli` on
|
| 193 |
-
the same build inserts an `<asr_text>` marker between the language and the text:
|
| 194 |
|
| 195 |
<div dir="rtl" lang="ar">language Darija<asr_text>التلفون ديالي طاح وتهرس ليه l'écran</div>
|
| 196 |
|
| 197 |
-
|
| 198 |
|
| 199 |
```python
|
| 200 |
import re
|
|
@@ -209,60 +154,37 @@ def parse(raw: str) -> tuple[str | None, str]:
|
|
| 209 |
The language name is ASCII and runs directly into Arabic text, so match on `[A-Za-z]+`
|
| 210 |
rather than `\S+` — otherwise the first Arabic word gets swallowed into the language field.
|
| 211 |
|
| 212 |
-
## Settings that affect accuracy
|
| 213 |
-
|
| 214 |
-
These defaults are what the reference results were produced with. Changing them to save
|
| 215 |
-
memory degrades transcription quality, usually without any error message.
|
| 216 |
-
|
| 217 |
-
| Setting | Use | Notes |
|
| 218 |
-
|---|---|---|
|
| 219 |
-
| `--cache-type-k` / `-v` | `f16` | `q8_0` measurably degrades word accuracy. |
|
| 220 |
-
| `-c` | `8192` | |
|
| 221 |
-
| `-b` / `-ub` | `2048` / `512` | llama.cpp defaults; smaller values change results. |
|
| 222 |
-
| `--temp` | `0` | |
|
| 223 |
-
| `-n` / `max_tokens` | `512` | |
|
| 224 |
-
| `--jinja` | enabled | Needed for the chat template. |
|
| 225 |
-
|
| 226 |
-
Audio is resampled internally to 16 kHz mono, so any sample rate works. Resampling
|
| 227 |
-
beforehand changes nothing — verified byte-identical on a 48 kHz source.
|
| 228 |
-
|
| 229 |
-
If you are memory constrained, lower `-c` first. It has the largest footprint (the KV cache
|
| 230 |
-
at `-c 8192` is ~900 MB) and the least effect on quality for short clips.
|
| 231 |
-
|
| 232 |
## Reference output
|
| 233 |
|
| 234 |
Use this to verify your setup. Reference clip: 3.11 s, 16 kHz mono WAV, DarijaCS Probe,
|
| 235 |
-
code-switched Darija–French. The
|
| 236 |
same pipeline with its own weights.
|
| 237 |
|
| 238 |
Ground truth:
|
| 239 |
|
| 240 |
<div dir="rtl" lang="ar">الtéléphone ديالي طاح وتهرس l'écran.</div>
|
| 241 |
|
| 242 |
-
`
|
| 243 |
-
`<asr_text>` marker:
|
| 244 |
|
| 245 |
<div dir="rtl" lang="ar">التلفون ديالي طاح وتهرس ليه l'écran</div>
|
| 246 |
|
| 247 |
-
`
|
|
|
|
| 248 |
|
| 249 |
-
|
| 250 |
|
| 251 |
-
|
| 252 |
-
word in Arabic script (`الtéléphone` → `التلفون`) and adds `ليه` before `l'écran`. Q4_K_M is
|
| 253 |
-
the configuration used for the published evaluation.
|
| 254 |
|
| 255 |
-
|
|
|
|
|
|
|
| 256 |
|
| 257 |
-
|
| 258 |
|
| 259 |
```
|
| 260 |
-
|
| 261 |
-
541e2927c1bbb7395adb17ce2a48e753 mmproj-fihria-asr-0.6b-BF16.gguf
|
| 262 |
```
|
| 263 |
|
| 264 |
-
1.7B: added with that release.
|
| 265 |
-
|
| 266 |
## Citation
|
| 267 |
|
| 268 |
If you use fihrIA-ASR, please cite the paper:
|
|
@@ -285,22 +207,11 @@ If you use fihrIA-ASR, please cite the paper:
|
|
| 285 |
## Known limitations
|
| 286 |
|
| 287 |
- Long audio is chunked in 30 s windows by the encoder; very long files are slower and may drift.
|
| 288 |
-
- Occasional runaway repetition if generation hits the token limit. Cap `max_tokens` and
|
| 289 |
-
de-duplicate trailing repeated spans if you see it.
|
| 290 |
- Fine-tuned for Darija. Other languages fall back to base Qwen3-ASR behaviour and are untested here.
|
| 291 |
-
-
|
| 292 |
-
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
mkdir -p models && curl -sSL -o models/silero_vad.onnx \
|
| 299 |
-
https://raw.githubusercontent.com/snakers4/silero-vad/master/src/silero_vad/data/silero_vad.onnx
|
| 300 |
-
|
| 301 |
-
python3 asr_guards.py empty.wav --json # speech: false → skip ASR
|
| 302 |
-
python3 transcribe.py --audio clip.wav --require-speech
|
| 303 |
-
```
|
| 304 |
-
|
| 305 |
-
Defaults that separate empty/music (mean≈0.01) from speech (mean≈0.5+): require
|
| 306 |
-
`mean_prob >= 0.25` **or** `fraction(prob>=0.5) >= 0.15`.
|
|
|
|
| 4 |
- ar
|
| 5 |
- ary
|
| 6 |
pipeline_tag: automatic-speech-recognition
|
| 7 |
+
library_name: transformers
|
| 8 |
+
base_model: Qwen/Qwen3-ASR-0.6B
|
| 9 |
tags:
|
| 10 |
- automatic-speech-recognition
|
| 11 |
- darija
|
| 12 |
- fihria
|
| 13 |
- moroccan-arabic
|
| 14 |
- qwen3-asr
|
| 15 |
+
- safetensors
|
|
|
|
|
|
|
| 16 |
- code-switching
|
| 17 |
---
|
| 18 |
|
|
|
|
| 34 |
|
| 35 |
## Technical & deployment details
|
| 36 |
|
| 37 |
+
This repository hosts the unquantized **BF16 safetensors** weights, configs, and 89k Darija
|
| 38 |
+
tokenizer for use with `qwen-asr`, `transformers`, and `vLLM`. If you are deploying on CPU or
|
| 39 |
+
with `llama.cpp`, use the matching GGUF repositories below.
|
|
|
|
| 40 |
|
| 41 |
+
Repositories are hosted separately by size and format, sharing an identical layout:
|
| 42 |
|
| 43 |
+
- **0.6B (safetensors):** [`fihriaLab/fihrIA-ASR-0.6B`](https://huggingface.co/fihriaLab/fihrIA-ASR-0.6B)
|
| 44 |
+
- **1.7B (safetensors):** [`fihriaLab/fihrIA-ASR-1.7B`](https://huggingface.co/fihriaLab/fihrIA-ASR-1.7B)
|
| 45 |
+
- **0.6B (GGUF / llama.cpp):** [`fihriaLab/fihrIA-ASR-0.6B-GGUF`](https://huggingface.co/fihriaLab/fihrIA-ASR-0.6B-GGUF)
|
| 46 |
+
- **1.7B (GGUF / llama.cpp):** [`fihriaLab/fihrIA-ASR-1.7B-GGUF`](https://huggingface.co/fihriaLab/fihrIA-ASR-1.7B-GGUF)
|
| 47 |
|
| 48 |
## Results
|
| 49 |
|
|
|
|
| 72 |
|
| 73 |
## Files
|
| 74 |
|
| 75 |
+
Each safetensors repository carries its own size (`0.6B` or `1.7B`) in BF16:
|
| 76 |
|
| 77 |
+
| File | Size (0.6B / 1.7B) | Description |
|
| 78 |
|---|---|---|
|
| 79 |
+
| `model.safetensors` | 1.44 GB / 3.82 GB | Full BF16 weights (audio encoder + multimodal projector + language model). |
|
| 80 |
+
| `config.json`, `generation_config.json`, `preprocessor_config.json` | — | Model, generation, and audio feature extractor configs. |
|
| 81 |
+
| `tokenizer.json`, `vocab.json`, `merges.txt`, `tokenizer_config.json`, `special_tokens_map.json`, `chat_template.json` | — | Shared 89k-token Darija tokenizer (do **not** swap with the 151k Qwen base tokenizer). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
## Quick start
|
| 84 |
|
| 85 |
+
Install the [`qwen-asr`](https://github.com/QwenLM/Qwen3-ASR) package (supports both the
|
| 86 |
+
`transformers` and `vLLM` backends):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
```bash
|
| 89 |
+
pip install -U qwen-asr
|
| 90 |
+
# or with vLLM backend:
|
| 91 |
+
# pip install -U "qwen-asr[vllm]"
|
| 92 |
```
|
| 93 |
|
| 94 |
+
### Python (`qwen-asr` / transformers backend)
|
| 95 |
|
| 96 |
+
```python
|
| 97 |
+
import torch
|
| 98 |
+
from qwen_asr import Qwen3ASRModel
|
| 99 |
+
|
| 100 |
+
model = Qwen3ASRModel.from_pretrained(
|
| 101 |
+
"fihriaLab/fihrIA-ASR-0.6B", # or "fihriaLab/fihrIA-ASR-1.7B"
|
| 102 |
+
dtype=torch.bfloat16,
|
| 103 |
+
device_map="cuda:0",
|
| 104 |
+
# attn_implementation="flash_attention_2",
|
| 105 |
+
max_inference_batch_size=32,
|
| 106 |
+
max_new_tokens=512,
|
| 107 |
+
)
|
| 108 |
+
|
| 109 |
+
results = model.transcribe(
|
| 110 |
+
audio="sample.wav",
|
| 111 |
+
language=None, # or "Darija"
|
| 112 |
+
)
|
| 113 |
+
|
| 114 |
+
print(results[0].language)
|
| 115 |
+
print(results[0].text)
|
| 116 |
```
|
| 117 |
|
| 118 |
+
### vLLM backend
|
|
|
|
|
|
|
| 119 |
|
| 120 |
+
```python
|
| 121 |
+
import torch
|
| 122 |
+
from qwen_asr import Qwen3ASRModel
|
| 123 |
+
|
| 124 |
+
model = Qwen3ASRModel.LLM(
|
| 125 |
+
model="fihriaLab/fihrIA-ASR-0.6B", # or "fihriaLab/fihrIA-ASR-1.7B"
|
| 126 |
+
gpu_memory_utilization=0.7,
|
| 127 |
+
max_inference_batch_size=128,
|
| 128 |
+
max_new_tokens=512,
|
| 129 |
+
)
|
| 130 |
+
|
| 131 |
+
results = model.transcribe(audio="sample.wav", language=None)
|
| 132 |
+
print(results[0].text)
|
| 133 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
|
| 135 |
## Output format
|
| 136 |
|
| 137 |
+
Raw decoder outputs emit the detected language followed by `<asr_text>` and the transcript
|
| 138 |
+
(handled automatically by `qwen-asr`):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
|
| 140 |
<div dir="rtl" lang="ar">language Darija<asr_text>التلفون ديالي طاح وتهرس ليه l'écran</div>
|
| 141 |
|
| 142 |
+
If you decode directly without `qwen-asr`, parse both forms (with or without `<asr_text>`):
|
| 143 |
|
| 144 |
```python
|
| 145 |
import re
|
|
|
|
| 154 |
The language name is ASCII and runs directly into Arabic text, so match on `[A-Za-z]+`
|
| 155 |
rather than `\S+` — otherwise the first Arabic word gets swallowed into the language field.
|
| 156 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
## Reference output
|
| 158 |
|
| 159 |
Use this to verify your setup. Reference clip: 3.11 s, 16 kHz mono WAV, DarijaCS Probe,
|
| 160 |
+
code-switched Darija–French. The transcript below is the 0.6B; the 1.7B runs through the
|
| 161 |
same pipeline with its own weights.
|
| 162 |
|
| 163 |
Ground truth:
|
| 164 |
|
| 165 |
<div dir="rtl" lang="ar">الtéléphone ديالي طاح وتهرس l'écran.</div>
|
| 166 |
|
| 167 |
+
`BF16` transcript after stripping the `language Darija` prefix and the `<asr_text>` marker:
|
|
|
|
| 168 |
|
| 169 |
<div dir="rtl" lang="ar">التلفون ديالي طاح وتهرس ليه l'écran</div>
|
| 170 |
|
| 171 |
+
The model writes the French word in Arabic script (`الtéléphone` → `التلفون`) and adds `ليه`
|
| 172 |
+
before `l'écran`.
|
| 173 |
|
| 174 |
+
## Checksums (MD5)
|
| 175 |
|
| 176 |
+
0.6B (`fihriaLab/fihrIA-ASR-0.6B`):
|
|
|
|
|
|
|
| 177 |
|
| 178 |
+
```
|
| 179 |
+
1d178f7518e92b2f26ea527922b6c9ec model.safetensors
|
| 180 |
+
```
|
| 181 |
|
| 182 |
+
1.7B (`fihriaLab/fihrIA-ASR-1.7B`):
|
| 183 |
|
| 184 |
```
|
| 185 |
+
4f6affaef879d6109d1deec7874e4016 model.safetensors
|
|
|
|
| 186 |
```
|
| 187 |
|
|
|
|
|
|
|
| 188 |
## Citation
|
| 189 |
|
| 190 |
If you use fihrIA-ASR, please cite the paper:
|
|
|
|
| 207 |
## Known limitations
|
| 208 |
|
| 209 |
- Long audio is chunked in 30 s windows by the encoder; very long files are slower and may drift.
|
|
|
|
|
|
|
| 210 |
- Fine-tuned for Darija. Other languages fall back to base Qwen3-ASR behaviour and are untested here.
|
| 211 |
+
- **Non-speech & music.** This release includes weight-level fixes that eliminate silence and
|
| 212 |
+
synthetic-noise hallucinations (and dramatically reduce real-noise hallucinations, runaway
|
| 213 |
+
repetition loops, and 1.7B prompt echoes). Vocal music is still transcribed as lyrics, and
|
| 214 |
+
some noisy/instrumental clips can occasionally produce short text — for noisy production
|
| 215 |
+
pipelines, gating with a lightweight VAD (e.g., Silero VAD) is still recommended.
|
| 216 |
+
- `transformers` support for the `qwen3_asr` architecture is recent; use `qwen-asr` or a
|
| 217 |
+
recent `transformers` release, or use the GGUF builds with `llama.cpp`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
asr_guards.py
DELETED
|
@@ -1,287 +0,0 @@
|
|
| 1 |
-
#!/usr/bin/env python3
|
| 2 |
-
"""Deployment guards against empty/music ASR hallucinations.
|
| 3 |
-
|
| 4 |
-
Qwen3-ASR (including empty-robust finetunes) often emits a fixed Darija
|
| 5 |
-
boilerplate on silence, noise, or music, e.g.:
|
| 6 |
-
|
| 7 |
-
السلام عليكم، اليوم غادي نهضرو على واحد الموضوع اللي هو مهم بزاف، اللي هو التغذية الصحية.
|
| 8 |
-
|
| 9 |
-
Use two layers:
|
| 10 |
-
|
| 11 |
-
1. Silero VAD speech gate — skip ASR when almost no frames look like speech.
|
| 12 |
-
Empty/music clips in /home/anas/Music score mean≈0.01–0.02; real Darija
|
| 13 |
-
speech scores mean≈0.5–0.9. Default: require mean_prob >= 0.25 OR
|
| 14 |
-
fraction of frames with prob>=0.5 >= 0.15.
|
| 15 |
-
|
| 16 |
-
2. Known-hallucination filter — blank the transcript when it matches (or is a
|
| 17 |
-
near-duplicate of) canned phrases the model regurgitates on non-speech.
|
| 18 |
-
|
| 19 |
-
from asr_guards import speech_stats, has_speech, scrub_hallucination
|
| 20 |
-
|
| 21 |
-
if not has_speech(wav_samples_f32):
|
| 22 |
-
return ""
|
| 23 |
-
text = scrub_hallucination(model_output)
|
| 24 |
-
"""
|
| 25 |
-
|
| 26 |
-
from __future__ import annotations
|
| 27 |
-
|
| 28 |
-
import argparse
|
| 29 |
-
import contextlib
|
| 30 |
-
import os
|
| 31 |
-
import re
|
| 32 |
-
import sys
|
| 33 |
-
import wave
|
| 34 |
-
from pathlib import Path
|
| 35 |
-
from typing import Any
|
| 36 |
-
|
| 37 |
-
import numpy as np
|
| 38 |
-
|
| 39 |
-
SAMPLE_RATE = 16000
|
| 40 |
-
VAD_WINDOW = 512
|
| 41 |
-
VAD_CONTEXT = 64
|
| 42 |
-
|
| 43 |
-
DEFAULT_VAD_MODEL = Path(__file__).resolve().parent / "models" / "silero_vad.onnx" # download via README
|
| 44 |
-
|
| 45 |
-
# Exact / near-exact strings observed on empty and music inputs.
|
| 46 |
-
KNOWN_HALLUCINATIONS = (
|
| 47 |
-
"السلام عليكم، اليوم غادي نهضرو على واحد الموضوع اللي هو مهم بزاف، اللي هو التغذية الصحية.",
|
| 48 |
-
"السلام عليكم اليوم غادي نهضرو على واحد الموضوع اللي هو مهم بزاف اللي هو التغذية الصحية",
|
| 49 |
-
)
|
| 50 |
-
|
| 51 |
-
# Distinctive substrings that are enough to reject (low false-positive risk).
|
| 52 |
-
HALLUCINATION_MARKERS = (
|
| 53 |
-
"التغذية الصحية",
|
| 54 |
-
"نهضرو على واحد الموضوع",
|
| 55 |
-
)
|
| 56 |
-
|
| 57 |
-
_PUNCT_RE = re.compile(r"[\s\u060c\u061b\u061f،؛؟,.!?;:\"'()\[\]{}«»]+")
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
def normalize_ar(text: str) -> str:
|
| 61 |
-
text = text.strip()
|
| 62 |
-
text = text.replace("أ", "ا").replace("إ", "ا").replace("آ", "ا").replace("ة", "ه")
|
| 63 |
-
text = _PUNCT_RE.sub("", text)
|
| 64 |
-
return text
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
def is_known_hallucination(text: str) -> bool:
|
| 68 |
-
"""True when the transcript is a known empty/music hallucination."""
|
| 69 |
-
cleaned = (text or "").strip()
|
| 70 |
-
if not cleaned:
|
| 71 |
-
return False
|
| 72 |
-
norm = normalize_ar(cleaned)
|
| 73 |
-
for phrase in KNOWN_HALLUCINATIONS:
|
| 74 |
-
if normalize_ar(phrase) == norm:
|
| 75 |
-
return True
|
| 76 |
-
# Model sometimes prepends/appends a word or drops a comma.
|
| 77 |
-
if normalize_ar(phrase) in norm and len(norm) <= len(normalize_ar(phrase)) + 12:
|
| 78 |
-
return True
|
| 79 |
-
# Marker pair: both distinctive fragments present and transcript is short.
|
| 80 |
-
if len(norm) < 120 and all(normalize_ar(m) in norm for m in HALLUCINATION_MARKERS):
|
| 81 |
-
return True
|
| 82 |
-
return False
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
def scrub_hallucination(text: str) -> str:
|
| 86 |
-
"""Return empty string for known hallucinations, otherwise the original text."""
|
| 87 |
-
cleaned = (text or "").strip()
|
| 88 |
-
if is_known_hallucination(cleaned):
|
| 89 |
-
return ""
|
| 90 |
-
return cleaned
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
@contextlib.contextmanager
|
| 94 |
-
def _suppressed_stderr():
|
| 95 |
-
saved = os.dup(2)
|
| 96 |
-
devnull = os.open(os.devnull, os.O_WRONLY)
|
| 97 |
-
try:
|
| 98 |
-
os.dup2(devnull, 2)
|
| 99 |
-
yield
|
| 100 |
-
finally:
|
| 101 |
-
os.dup2(saved, 2)
|
| 102 |
-
os.close(devnull)
|
| 103 |
-
os.close(saved)
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
class SileroSpeechGate:
|
| 107 |
-
"""Frame-level Silero VAD used as a pre-ASR speech / non-speech gate."""
|
| 108 |
-
|
| 109 |
-
def __init__(self, model_path: Path | str = DEFAULT_VAD_MODEL) -> None:
|
| 110 |
-
model_path = Path(model_path)
|
| 111 |
-
if not model_path.is_file():
|
| 112 |
-
raise FileNotFoundError(
|
| 113 |
-
f"Silero VAD model not found: {model_path}\n"
|
| 114 |
-
" curl -sSL -o models/silero_vad.onnx "
|
| 115 |
-
"https://raw.githubusercontent.com/snakers4/silero-vad/master/"
|
| 116 |
-
"src/silero_vad/data/silero_vad.onnx"
|
| 117 |
-
)
|
| 118 |
-
with _suppressed_stderr():
|
| 119 |
-
import onnxruntime as ort
|
| 120 |
-
|
| 121 |
-
options = ort.SessionOptions()
|
| 122 |
-
options.log_severity_level = 4
|
| 123 |
-
options.inter_op_num_threads = 1
|
| 124 |
-
options.intra_op_num_threads = 1
|
| 125 |
-
self.session = ort.InferenceSession(
|
| 126 |
-
str(model_path), sess_options=options, providers=["CPUExecutionProvider"]
|
| 127 |
-
)
|
| 128 |
-
self.sr = np.array(SAMPLE_RATE, dtype="int64")
|
| 129 |
-
|
| 130 |
-
def _reset(self) -> tuple[np.ndarray, np.ndarray]:
|
| 131 |
-
state = np.zeros((2, 1, 128), dtype="float32")
|
| 132 |
-
context = np.zeros(VAD_CONTEXT, dtype="float32")
|
| 133 |
-
return state, context
|
| 134 |
-
|
| 135 |
-
def probs(self, audio: np.ndarray) -> np.ndarray:
|
| 136 |
-
if audio.dtype != np.float32:
|
| 137 |
-
audio = audio.astype("float32")
|
| 138 |
-
if audio.ndim > 1:
|
| 139 |
-
audio = audio.mean(axis=-1)
|
| 140 |
-
state, context = self._reset()
|
| 141 |
-
out: list[float] = []
|
| 142 |
-
for start in range(0, len(audio) - VAD_WINDOW + 1, VAD_WINDOW):
|
| 143 |
-
window = audio[start : start + VAD_WINDOW]
|
| 144 |
-
frame = np.concatenate([context, window]).reshape(1, -1).astype("float32")
|
| 145 |
-
prob, state = self.session.run(
|
| 146 |
-
None, {"input": frame, "state": state, "sr": self.sr}
|
| 147 |
-
)
|
| 148 |
-
context = window[-VAD_CONTEXT:]
|
| 149 |
-
out.append(float(prob[0][0]))
|
| 150 |
-
return np.asarray(out, dtype="float32")
|
| 151 |
-
|
| 152 |
-
def stats(self, audio: np.ndarray) -> dict[str, float]:
|
| 153 |
-
p = self.probs(audio)
|
| 154 |
-
if p.size == 0:
|
| 155 |
-
return {
|
| 156 |
-
"mean": 0.0,
|
| 157 |
-
"max": 0.0,
|
| 158 |
-
"median": 0.0,
|
| 159 |
-
"frac_ge_0_5": 0.0,
|
| 160 |
-
"n_frames": 0.0,
|
| 161 |
-
"duration_s": float(len(audio) / SAMPLE_RATE),
|
| 162 |
-
}
|
| 163 |
-
return {
|
| 164 |
-
"mean": float(p.mean()),
|
| 165 |
-
"max": float(p.max()),
|
| 166 |
-
"median": float(np.median(p)),
|
| 167 |
-
"frac_ge_0_5": float((p >= 0.5).mean()),
|
| 168 |
-
"n_frames": float(p.size),
|
| 169 |
-
"duration_s": float(len(audio) / SAMPLE_RATE),
|
| 170 |
-
}
|
| 171 |
-
|
| 172 |
-
def has_speech(
|
| 173 |
-
self,
|
| 174 |
-
audio: np.ndarray,
|
| 175 |
-
*,
|
| 176 |
-
min_mean: float = 0.25,
|
| 177 |
-
min_frac_ge_0_5: float = 0.15,
|
| 178 |
-
) -> bool:
|
| 179 |
-
"""True if the clip likely contains spoken speech (not music/silence)."""
|
| 180 |
-
s = self.stats(audio)
|
| 181 |
-
return s["mean"] >= min_mean or s["frac_ge_0_5"] >= min_frac_ge_0_5
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
_gate: SileroSpeechGate | None = None
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
def get_gate(model_path: Path | str | None = None) -> SileroSpeechGate:
|
| 188 |
-
global _gate
|
| 189 |
-
if _gate is None or (model_path and Path(model_path) != DEFAULT_VAD_MODEL):
|
| 190 |
-
_gate = SileroSpeechGate(model_path or DEFAULT_VAD_MODEL)
|
| 191 |
-
return _gate
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
def load_wav_mono16k(path: Path | str) -> np.ndarray:
|
| 195 |
-
path = Path(path)
|
| 196 |
-
with wave.open(str(path), "rb") as handle:
|
| 197 |
-
nch, width, sr, nframes, *_ = handle.getparams()
|
| 198 |
-
raw = handle.readframes(nframes)
|
| 199 |
-
if width != 2:
|
| 200 |
-
raise ValueError(f"Expected 16-bit PCM WAV, got sample width {width}: {path}")
|
| 201 |
-
audio = np.frombuffer(raw, dtype=np.int16).astype(np.float32) / 32768.0
|
| 202 |
-
if nch > 1:
|
| 203 |
-
audio = audio.reshape(-1, nch).mean(axis=1)
|
| 204 |
-
if sr != SAMPLE_RATE:
|
| 205 |
-
n_new = max(1, int(round(len(audio) * SAMPLE_RATE / sr)))
|
| 206 |
-
audio = np.interp(
|
| 207 |
-
np.linspace(0.0, 1.0, n_new, endpoint=False),
|
| 208 |
-
np.linspace(0.0, 1.0, len(audio), endpoint=False),
|
| 209 |
-
audio,
|
| 210 |
-
).astype(np.float32)
|
| 211 |
-
return audio
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
def speech_stats(audio: np.ndarray | Path | str, *, vad_model: Path | str | None = None) -> dict[str, float]:
|
| 215 |
-
if not isinstance(audio, np.ndarray):
|
| 216 |
-
audio = load_wav_mono16k(audio)
|
| 217 |
-
return get_gate(vad_model).stats(audio)
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
def has_speech(
|
| 221 |
-
audio: np.ndarray | Path | str,
|
| 222 |
-
*,
|
| 223 |
-
vad_model: Path | str | None = None,
|
| 224 |
-
min_mean: float = 0.25,
|
| 225 |
-
min_frac_ge_0_5: float = 0.15,
|
| 226 |
-
) -> bool:
|
| 227 |
-
if not isinstance(audio, np.ndarray):
|
| 228 |
-
audio = load_wav_mono16k(audio)
|
| 229 |
-
return get_gate(vad_model).has_speech(
|
| 230 |
-
audio, min_mean=min_mean, min_frac_ge_0_5=min_frac_ge_0_5
|
| 231 |
-
)
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
def filter_transcription(text: str, *, audio: np.ndarray | Path | str | None = None) -> str:
|
| 235 |
-
"""Apply hallucination scrub, and optional VAD gate when audio is provided."""
|
| 236 |
-
if audio is not None and not has_speech(audio):
|
| 237 |
-
return ""
|
| 238 |
-
return scrub_hallucination(text)
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
def main(argv: list[str] | None = None) -> int:
|
| 242 |
-
parser = argparse.ArgumentParser(description=__doc__)
|
| 243 |
-
parser.add_argument("audio", type=Path, nargs="?", help="WAV to score / gate")
|
| 244 |
-
parser.add_argument("--vad-model", type=Path, default=DEFAULT_VAD_MODEL)
|
| 245 |
-
parser.add_argument("--min-mean", type=float, default=0.25)
|
| 246 |
-
parser.add_argument("--min-frac", type=float, default=0.15)
|
| 247 |
-
parser.add_argument(
|
| 248 |
-
"--check-text",
|
| 249 |
-
default=None,
|
| 250 |
-
help="Also test a transcript against the hallucination filter",
|
| 251 |
-
)
|
| 252 |
-
parser.add_argument("--json", action="store_true")
|
| 253 |
-
args = parser.parse_args(argv)
|
| 254 |
-
|
| 255 |
-
result: dict[str, Any] = {}
|
| 256 |
-
if args.audio is not None:
|
| 257 |
-
stats = speech_stats(args.audio, vad_model=args.vad_model)
|
| 258 |
-
ok = stats["mean"] >= args.min_mean or stats["frac_ge_0_5"] >= args.min_frac
|
| 259 |
-
result["speech"] = ok
|
| 260 |
-
result["vad"] = stats
|
| 261 |
-
if not args.json:
|
| 262 |
-
verdict = "SPEECH" if ok else "NO_SPEECH"
|
| 263 |
-
print(
|
| 264 |
-
f"{verdict} mean={stats['mean']:.3f} "
|
| 265 |
-
f"frac>=0.5={stats['frac_ge_0_5']:.2f} "
|
| 266 |
-
f"max={stats['max']:.3f} dur={stats['duration_s']:.2f}s"
|
| 267 |
-
)
|
| 268 |
-
|
| 269 |
-
if args.check_text is not None:
|
| 270 |
-
bad = is_known_hallucination(args.check_text)
|
| 271 |
-
result["hallucination"] = bad
|
| 272 |
-
result["scrubbed"] = scrub_hallucination(args.check_text)
|
| 273 |
-
if not args.json:
|
| 274 |
-
print("HALLUCINATION" if bad else "OK", repr(result["scrubbed"]))
|
| 275 |
-
|
| 276 |
-
if args.json:
|
| 277 |
-
print(__import__("json").dumps(result, ensure_ascii=False))
|
| 278 |
-
|
| 279 |
-
if args.audio is not None and not result.get("speech", True):
|
| 280 |
-
return 2
|
| 281 |
-
if args.check_text is not None and result.get("hallucination"):
|
| 282 |
-
return 3
|
| 283 |
-
return 0
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
if __name__ == "__main__":
|
| 287 |
-
raise SystemExit(main())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
chat_template.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"chat_template": "{%- set ns = namespace(system_text=\"\") -%}\n{%- for m in messages -%}\n {%- if m.role == 'system' -%}\n {%- if m.content is string -%}\n {%- set ns.system_text = ns.system_text + m.content -%}\n {%- else -%}\n {%- for c in m.content -%}\n {%- if c.type == 'text' and (c.text is defined) -%}\n {%- set ns.system_text = ns.system_text + c.text -%}\n {%- endif -%}\n {%- endfor -%}\n {%- endif -%}\n {%- endif -%}\n{%- endfor -%}\n\n{%- set ns2 = namespace(audio_tokens=\"\") -%}\n{%- for m in messages -%}\n {%- if m.content is not string -%}\n {%- for c in m.content -%}\n {%- if c.type == 'audio' or ('audio' in c) or ('audio_url' in c) -%}\n {%- set ns2.audio_tokens = ns2.audio_tokens + \"<|audio_start|><|audio_pad|><|audio_end|>\" -%}\n {%- endif -%}\n {%- endfor -%}\n {%- endif -%}\n{%- endfor -%}\n\n{{- '<|im_start|>system\\n' + (ns.system_text if ns.system_text is string else '') + '<|im_end|>\\n' -}}\n{{- '<|im_start|>user\\n' + ns2.audio_tokens + '<|im_end|>\\n' -}}\n{%- if add_generation_prompt -%}\n{{- '<|im_start|>assistant\\n' -}}\n{%- endif -%}"}
|
config.json
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Qwen3ASRForConditionalGeneration"
|
| 4 |
+
],
|
| 5 |
+
"dtype": "bfloat16",
|
| 6 |
+
"eos_token_id": [
|
| 7 |
+
2,
|
| 8 |
+
0
|
| 9 |
+
],
|
| 10 |
+
"model_type": "qwen3_asr",
|
| 11 |
+
"pad_token_id": 0,
|
| 12 |
+
"support_languages": [
|
| 13 |
+
"Chinese",
|
| 14 |
+
"English",
|
| 15 |
+
"Cantonese",
|
| 16 |
+
"Arabic",
|
| 17 |
+
"German",
|
| 18 |
+
"French",
|
| 19 |
+
"Spanish",
|
| 20 |
+
"Portuguese",
|
| 21 |
+
"Indonesian",
|
| 22 |
+
"Italian",
|
| 23 |
+
"Korean",
|
| 24 |
+
"Russian",
|
| 25 |
+
"Thai",
|
| 26 |
+
"Vietnamese",
|
| 27 |
+
"Japanese",
|
| 28 |
+
"Turkish",
|
| 29 |
+
"Hindi",
|
| 30 |
+
"Malay",
|
| 31 |
+
"Dutch",
|
| 32 |
+
"Swedish",
|
| 33 |
+
"Danish",
|
| 34 |
+
"Finnish",
|
| 35 |
+
"Polish",
|
| 36 |
+
"Czech",
|
| 37 |
+
"Filipino",
|
| 38 |
+
"Persian",
|
| 39 |
+
"Greek",
|
| 40 |
+
"Romanian",
|
| 41 |
+
"Hungarian",
|
| 42 |
+
"Macedonian",
|
| 43 |
+
"Darija"
|
| 44 |
+
],
|
| 45 |
+
"thinker_config": {
|
| 46 |
+
"architectures": [
|
| 47 |
+
"Qwen3ASRThinkerForConditionalGeneration"
|
| 48 |
+
],
|
| 49 |
+
"audio_config": {
|
| 50 |
+
"_name_or_path": "",
|
| 51 |
+
"activation_dropout": 0,
|
| 52 |
+
"activation_function": "gelu",
|
| 53 |
+
"add_cross_attention": false,
|
| 54 |
+
"architectures": null,
|
| 55 |
+
"attention_dropout": 0,
|
| 56 |
+
"bad_words_ids": null,
|
| 57 |
+
"begin_suppress_tokens": null,
|
| 58 |
+
"bos_token_id": null,
|
| 59 |
+
"chunk_size_feed_forward": 0,
|
| 60 |
+
"conv_chunksize": 500,
|
| 61 |
+
"cross_attention_hidden_size": null,
|
| 62 |
+
"d_model": 896,
|
| 63 |
+
"decoder_start_token_id": null,
|
| 64 |
+
"diversity_penalty": 0.0,
|
| 65 |
+
"do_sample": false,
|
| 66 |
+
"downsample_hidden_size": 480,
|
| 67 |
+
"dropout": 0,
|
| 68 |
+
"dtype": null,
|
| 69 |
+
"early_stopping": false,
|
| 70 |
+
"encoder_attention_heads": 14,
|
| 71 |
+
"encoder_ffn_dim": 3584,
|
| 72 |
+
"encoder_layers": 18,
|
| 73 |
+
"encoder_no_repeat_ngram_size": 0,
|
| 74 |
+
"eos_token_id": null,
|
| 75 |
+
"exponential_decay_length_penalty": null,
|
| 76 |
+
"finetuning_task": null,
|
| 77 |
+
"forced_bos_token_id": null,
|
| 78 |
+
"forced_eos_token_id": null,
|
| 79 |
+
"id2label": {
|
| 80 |
+
"0": "LABEL_0",
|
| 81 |
+
"1": "LABEL_1"
|
| 82 |
+
},
|
| 83 |
+
"initializer_range": 0.02,
|
| 84 |
+
"is_decoder": false,
|
| 85 |
+
"is_encoder_decoder": false,
|
| 86 |
+
"label2id": {
|
| 87 |
+
"LABEL_0": 0,
|
| 88 |
+
"LABEL_1": 1
|
| 89 |
+
},
|
| 90 |
+
"length_penalty": 1.0,
|
| 91 |
+
"max_length": 20,
|
| 92 |
+
"max_source_positions": 1500,
|
| 93 |
+
"min_length": 0,
|
| 94 |
+
"model_type": "qwen3_asr_audio_encoder",
|
| 95 |
+
"n_window": 50,
|
| 96 |
+
"n_window_infer": 800,
|
| 97 |
+
"no_repeat_ngram_size": 0,
|
| 98 |
+
"num_beam_groups": 1,
|
| 99 |
+
"num_beams": 1,
|
| 100 |
+
"num_hidden_layers": 18,
|
| 101 |
+
"num_mel_bins": 128,
|
| 102 |
+
"num_return_sequences": 1,
|
| 103 |
+
"output_attentions": false,
|
| 104 |
+
"output_dim": 1024,
|
| 105 |
+
"output_hidden_states": false,
|
| 106 |
+
"output_scores": false,
|
| 107 |
+
"pad_token_id": null,
|
| 108 |
+
"prefix": null,
|
| 109 |
+
"problem_type": null,
|
| 110 |
+
"pruned_heads": {},
|
| 111 |
+
"remove_invalid_values": false,
|
| 112 |
+
"repetition_penalty": 1.0,
|
| 113 |
+
"return_dict": true,
|
| 114 |
+
"return_dict_in_generate": false,
|
| 115 |
+
"scale_embedding": false,
|
| 116 |
+
"sep_token_id": null,
|
| 117 |
+
"suppress_tokens": null,
|
| 118 |
+
"task_specific_params": null,
|
| 119 |
+
"temperature": 1.0,
|
| 120 |
+
"tf_legacy_loss": false,
|
| 121 |
+
"tie_encoder_decoder": false,
|
| 122 |
+
"tie_word_embeddings": true,
|
| 123 |
+
"tokenizer_class": null,
|
| 124 |
+
"top_k": 50,
|
| 125 |
+
"top_p": 1.0,
|
| 126 |
+
"torchscript": false,
|
| 127 |
+
"typical_p": 1.0,
|
| 128 |
+
"use_bfloat16": false
|
| 129 |
+
},
|
| 130 |
+
"audio_end_token_id": 27,
|
| 131 |
+
"audio_start_token_id": 26,
|
| 132 |
+
"audio_token_id": 33,
|
| 133 |
+
"dtype": "bfloat16",
|
| 134 |
+
"eos_token_id": [
|
| 135 |
+
2,
|
| 136 |
+
0
|
| 137 |
+
],
|
| 138 |
+
"initializer_range": 0.02,
|
| 139 |
+
"model_type": "qwen3_asr_thinker",
|
| 140 |
+
"pad_token_id": 0,
|
| 141 |
+
"text_config": {
|
| 142 |
+
"_name_or_path": "",
|
| 143 |
+
"add_cross_attention": false,
|
| 144 |
+
"architectures": null,
|
| 145 |
+
"attention_bias": false,
|
| 146 |
+
"attention_dropout": 0.0,
|
| 147 |
+
"bad_words_ids": null,
|
| 148 |
+
"begin_suppress_tokens": null,
|
| 149 |
+
"bos_token_id": null,
|
| 150 |
+
"chunk_size_feed_forward": 0,
|
| 151 |
+
"cross_attention_hidden_size": null,
|
| 152 |
+
"decoder_start_token_id": null,
|
| 153 |
+
"diversity_penalty": 0.0,
|
| 154 |
+
"do_sample": false,
|
| 155 |
+
"dtype": null,
|
| 156 |
+
"early_stopping": false,
|
| 157 |
+
"encoder_no_repeat_ngram_size": 0,
|
| 158 |
+
"eos_token_id": null,
|
| 159 |
+
"exponential_decay_length_penalty": null,
|
| 160 |
+
"finetuning_task": null,
|
| 161 |
+
"forced_bos_token_id": null,
|
| 162 |
+
"forced_eos_token_id": null,
|
| 163 |
+
"head_dim": 128,
|
| 164 |
+
"hidden_act": "silu",
|
| 165 |
+
"hidden_size": 1024,
|
| 166 |
+
"id2label": {
|
| 167 |
+
"0": "LABEL_0",
|
| 168 |
+
"1": "LABEL_1"
|
| 169 |
+
},
|
| 170 |
+
"initializer_range": 0.02,
|
| 171 |
+
"intermediate_size": 3072,
|
| 172 |
+
"is_decoder": false,
|
| 173 |
+
"is_encoder_decoder": false,
|
| 174 |
+
"label2id": {
|
| 175 |
+
"LABEL_0": 0,
|
| 176 |
+
"LABEL_1": 1
|
| 177 |
+
},
|
| 178 |
+
"length_penalty": 1.0,
|
| 179 |
+
"max_length": 20,
|
| 180 |
+
"max_position_embeddings": 65536,
|
| 181 |
+
"min_length": 0,
|
| 182 |
+
"model_type": "qwen3_asr_text",
|
| 183 |
+
"no_repeat_ngram_size": 0,
|
| 184 |
+
"num_attention_heads": 16,
|
| 185 |
+
"num_beam_groups": 1,
|
| 186 |
+
"num_beams": 1,
|
| 187 |
+
"num_hidden_layers": 28,
|
| 188 |
+
"num_key_value_heads": 8,
|
| 189 |
+
"num_return_sequences": 1,
|
| 190 |
+
"output_attentions": false,
|
| 191 |
+
"output_hidden_states": false,
|
| 192 |
+
"output_scores": false,
|
| 193 |
+
"pad_token_id": null,
|
| 194 |
+
"prefix": null,
|
| 195 |
+
"problem_type": null,
|
| 196 |
+
"pruned_heads": {},
|
| 197 |
+
"remove_invalid_values": false,
|
| 198 |
+
"repetition_penalty": 1.0,
|
| 199 |
+
"return_dict": true,
|
| 200 |
+
"return_dict_in_generate": false,
|
| 201 |
+
"rms_norm_eps": 1e-06,
|
| 202 |
+
"rope_scaling": {
|
| 203 |
+
"interleaved": true,
|
| 204 |
+
"mrope_interleaved": true,
|
| 205 |
+
"mrope_section": [
|
| 206 |
+
24,
|
| 207 |
+
20,
|
| 208 |
+
20
|
| 209 |
+
],
|
| 210 |
+
"rope_type": "default",
|
| 211 |
+
"type": "default"
|
| 212 |
+
},
|
| 213 |
+
"rope_theta": 1000000,
|
| 214 |
+
"sep_token_id": null,
|
| 215 |
+
"suppress_tokens": null,
|
| 216 |
+
"task_specific_params": null,
|
| 217 |
+
"temperature": 1.0,
|
| 218 |
+
"tf_legacy_loss": false,
|
| 219 |
+
"tie_encoder_decoder": false,
|
| 220 |
+
"tie_word_embeddings": true,
|
| 221 |
+
"tokenizer_class": null,
|
| 222 |
+
"top_k": 50,
|
| 223 |
+
"top_p": 1.0,
|
| 224 |
+
"torchscript": false,
|
| 225 |
+
"typical_p": 1.0,
|
| 226 |
+
"use_bfloat16": false,
|
| 227 |
+
"use_cache": true,
|
| 228 |
+
"vocab_size": 89000
|
| 229 |
+
},
|
| 230 |
+
"use_cache": false,
|
| 231 |
+
"user_token_id": 872
|
| 232 |
+
},
|
| 233 |
+
"transformers_version": "4.57.6",
|
| 234 |
+
"use_cache": false
|
| 235 |
+
}
|
fihria-asr-0.6b-Q4_K_M.gguf
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:9c55c3dc940e0b1e532679437b0919b963a8af6caf8abdd1a5892fa4c247fc60
|
| 3 |
-
size 342106720
|
|
|
|
|
|
|
|
|
|
|
|
generation_config.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": false,
|
| 3 |
+
"do_sample": false,
|
| 4 |
+
"pad_token_id": 0,
|
| 5 |
+
"eos_token_id": [
|
| 6 |
+
2,
|
| 7 |
+
0
|
| 8 |
+
]
|
| 9 |
+
}
|
merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
mmproj-fihria-asr-0.6b-BF16.gguf
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:2391de296c0ae41d578a3eb9f946e81c245ea52043d9edbb0cb1075e5095ef35
|
| 3 |
-
size 378575520
|
|
|
|
|
|
|
|
|
|
|
|
fihria-asr-0.6b-BF16.gguf → model.safetensors
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0bad8d7e8e13be7e6e9f0b99d6c799ce044c5c729bfda3ec25eceecf0fbd2fe9
|
| 3 |
+
size 1436033440
|
preprocessor_config.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"chunk_length": 30,
|
| 3 |
+
"dither": 0.0,
|
| 4 |
+
"feature_extractor_type": "WhisperFeatureExtractor",
|
| 5 |
+
"feature_size": 128,
|
| 6 |
+
"hop_length": 160,
|
| 7 |
+
"n_fft": 400,
|
| 8 |
+
"n_samples": 480000,
|
| 9 |
+
"nb_max_frames": 3000,
|
| 10 |
+
"padding_side": "right",
|
| 11 |
+
"padding_value": 0.0,
|
| 12 |
+
"processor_class": "Qwen3ASRProcessor",
|
| 13 |
+
"return_attention_mask": true
|
| 14 |
+
}
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"audio_bos_token": "<|audio_start|>",
|
| 3 |
+
"audio_eos_token": "<|audio_end|>",
|
| 4 |
+
"audio_token": "<|audio_pad|>",
|
| 5 |
+
"eos_token": {
|
| 6 |
+
"content": "<|im_end|>",
|
| 7 |
+
"lstrip": false,
|
| 8 |
+
"normalized": false,
|
| 9 |
+
"rstrip": false,
|
| 10 |
+
"single_word": false
|
| 11 |
+
},
|
| 12 |
+
"pad_token": {
|
| 13 |
+
"content": "<|endoftext|>",
|
| 14 |
+
"lstrip": false,
|
| 15 |
+
"normalized": false,
|
| 16 |
+
"rstrip": false,
|
| 17 |
+
"single_word": false
|
| 18 |
+
}
|
| 19 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,518 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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| 10 |
+
"special": true
|
| 11 |
+
},
|
| 12 |
+
"1": {
|
| 13 |
+
"content": "<|im_start|>",
|
| 14 |
+
"lstrip": false,
|
| 15 |
+
"normalized": false,
|
| 16 |
+
"rstrip": false,
|
| 17 |
+
"single_word": false,
|
| 18 |
+
"special": true
|
| 19 |
+
},
|
| 20 |
+
"2": {
|
| 21 |
+
"content": "<|im_end|>",
|
| 22 |
+
"lstrip": false,
|
| 23 |
+
"normalized": false,
|
| 24 |
+
"rstrip": false,
|
| 25 |
+
"single_word": false,
|
| 26 |
+
"special": true
|
| 27 |
+
},
|
| 28 |
+
"3": {
|
| 29 |
+
"content": "<|object_ref_start|>",
|
| 30 |
+
"lstrip": false,
|
| 31 |
+
"normalized": false,
|
| 32 |
+
"rstrip": false,
|
| 33 |
+
"single_word": false,
|
| 34 |
+
"special": true
|
| 35 |
+
},
|
| 36 |
+
"4": {
|
| 37 |
+
"content": "<|object_ref_end|>",
|
| 38 |
+
"lstrip": false,
|
| 39 |
+
"normalized": false,
|
| 40 |
+
"rstrip": false,
|
| 41 |
+
"single_word": false,
|
| 42 |
+
"special": true
|
| 43 |
+
},
|
| 44 |
+
"5": {
|
| 45 |
+
"content": "<|box_start|>",
|
| 46 |
+
"lstrip": false,
|
| 47 |
+
"normalized": false,
|
| 48 |
+
"rstrip": false,
|
| 49 |
+
"single_word": false,
|
| 50 |
+
"special": true
|
| 51 |
+
},
|
| 52 |
+
"6": {
|
| 53 |
+
"content": "<|box_end|>",
|
| 54 |
+
"lstrip": false,
|
| 55 |
+
"normalized": false,
|
| 56 |
+
"rstrip": false,
|
| 57 |
+
"single_word": false,
|
| 58 |
+
"special": true
|
| 59 |
+
},
|
| 60 |
+
"7": {
|
| 61 |
+
"content": "<|quad_start|>",
|
| 62 |
+
"lstrip": false,
|
| 63 |
+
"normalized": false,
|
| 64 |
+
"rstrip": false,
|
| 65 |
+
"single_word": false,
|
| 66 |
+
"special": true
|
| 67 |
+
},
|
| 68 |
+
"8": {
|
| 69 |
+
"content": "<|quad_end|>",
|
| 70 |
+
"lstrip": false,
|
| 71 |
+
"normalized": false,
|
| 72 |
+
"rstrip": false,
|
| 73 |
+
"single_word": false,
|
| 74 |
+
"special": true
|
| 75 |
+
},
|
| 76 |
+
"9": {
|
| 77 |
+
"content": "<|vision_start|>",
|
| 78 |
+
"lstrip": false,
|
| 79 |
+
"normalized": false,
|
| 80 |
+
"rstrip": false,
|
| 81 |
+
"single_word": false,
|
| 82 |
+
"special": true
|
| 83 |
+
},
|
| 84 |
+
"10": {
|
| 85 |
+
"content": "<|vision_end|>",
|
| 86 |
+
"lstrip": false,
|
| 87 |
+
"normalized": false,
|
| 88 |
+
"rstrip": false,
|
| 89 |
+
"single_word": false,
|
| 90 |
+
"special": true
|
| 91 |
+
},
|
| 92 |
+
"11": {
|
| 93 |
+
"content": "<|vision_pad|>",
|
| 94 |
+
"lstrip": false,
|
| 95 |
+
"normalized": false,
|
| 96 |
+
"rstrip": false,
|
| 97 |
+
"single_word": false,
|
| 98 |
+
"special": true
|
| 99 |
+
},
|
| 100 |
+
"12": {
|
| 101 |
+
"content": "<|image_pad|>",
|
| 102 |
+
"lstrip": false,
|
| 103 |
+
"normalized": false,
|
| 104 |
+
"rstrip": false,
|
| 105 |
+
"single_word": false,
|
| 106 |
+
"special": true
|
| 107 |
+
},
|
| 108 |
+
"13": {
|
| 109 |
+
"content": "<|video_pad|>",
|
| 110 |
+
"lstrip": false,
|
| 111 |
+
"normalized": false,
|
| 112 |
+
"rstrip": false,
|
| 113 |
+
"single_word": false,
|
| 114 |
+
"special": true
|
| 115 |
+
},
|
| 116 |
+
"14": {
|
| 117 |
+
"content": "<tool_call>",
|
| 118 |
+
"lstrip": false,
|
| 119 |
+
"normalized": false,
|
| 120 |
+
"rstrip": false,
|
| 121 |
+
"single_word": false,
|
| 122 |
+
"special": true
|
| 123 |
+
},
|
| 124 |
+
"15": {
|
| 125 |
+
"content": "</tool_call>",
|
| 126 |
+
"lstrip": false,
|
| 127 |
+
"normalized": false,
|
| 128 |
+
"rstrip": false,
|
| 129 |
+
"single_word": false,
|
| 130 |
+
"special": true
|
| 131 |
+
},
|
| 132 |
+
"16": {
|
| 133 |
+
"content": "<|fim_prefix|>",
|
| 134 |
+
"lstrip": false,
|
| 135 |
+
"normalized": false,
|
| 136 |
+
"rstrip": false,
|
| 137 |
+
"single_word": false,
|
| 138 |
+
"special": true
|
| 139 |
+
},
|
| 140 |
+
"17": {
|
| 141 |
+
"content": "<|fim_middle|>",
|
| 142 |
+
"lstrip": false,
|
| 143 |
+
"normalized": false,
|
| 144 |
+
"rstrip": false,
|
| 145 |
+
"single_word": false,
|
| 146 |
+
"special": true
|
| 147 |
+
},
|
| 148 |
+
"18": {
|
| 149 |
+
"content": "<|fim_suffix|>",
|
| 150 |
+
"lstrip": false,
|
| 151 |
+
"normalized": false,
|
| 152 |
+
"rstrip": false,
|
| 153 |
+
"single_word": false,
|
| 154 |
+
"special": true
|
| 155 |
+
},
|
| 156 |
+
"19": {
|
| 157 |
+
"content": "<|fim_pad|>",
|
| 158 |
+
"lstrip": false,
|
| 159 |
+
"normalized": false,
|
| 160 |
+
"rstrip": false,
|
| 161 |
+
"single_word": false,
|
| 162 |
+
"special": true
|
| 163 |
+
},
|
| 164 |
+
"20": {
|
| 165 |
+
"content": "<|repo_name|>",
|
| 166 |
+
"lstrip": false,
|
| 167 |
+
"normalized": false,
|
| 168 |
+
"rstrip": false,
|
| 169 |
+
"single_word": false,
|
| 170 |
+
"special": true
|
| 171 |
+
},
|
| 172 |
+
"21": {
|
| 173 |
+
"content": "<|file_sep|>",
|
| 174 |
+
"lstrip": false,
|
| 175 |
+
"normalized": false,
|
| 176 |
+
"rstrip": false,
|
| 177 |
+
"single_word": false,
|
| 178 |
+
"special": true
|
| 179 |
+
},
|
| 180 |
+
"22": {
|
| 181 |
+
"content": "<tool_response>",
|
| 182 |
+
"lstrip": false,
|
| 183 |
+
"normalized": false,
|
| 184 |
+
"rstrip": false,
|
| 185 |
+
"single_word": false,
|
| 186 |
+
"special": true
|
| 187 |
+
},
|
| 188 |
+
"23": {
|
| 189 |
+
"content": "</tool_response>",
|
| 190 |
+
"lstrip": false,
|
| 191 |
+
"normalized": false,
|
| 192 |
+
"rstrip": false,
|
| 193 |
+
"single_word": false,
|
| 194 |
+
"special": true
|
| 195 |
+
},
|
| 196 |
+
"24": {
|
| 197 |
+
"content": "<think>",
|
| 198 |
+
"lstrip": false,
|
| 199 |
+
"normalized": false,
|
| 200 |
+
"rstrip": false,
|
| 201 |
+
"single_word": false,
|
| 202 |
+
"special": true
|
| 203 |
+
},
|
| 204 |
+
"25": {
|
| 205 |
+
"content": "</think>",
|
| 206 |
+
"lstrip": false,
|
| 207 |
+
"normalized": false,
|
| 208 |
+
"rstrip": false,
|
| 209 |
+
"single_word": false,
|
| 210 |
+
"special": true
|
| 211 |
+
},
|
| 212 |
+
"26": {
|
| 213 |
+
"content": "<|audio_start|>",
|
| 214 |
+
"lstrip": false,
|
| 215 |
+
"normalized": false,
|
| 216 |
+
"rstrip": false,
|
| 217 |
+
"single_word": false,
|
| 218 |
+
"special": true
|
| 219 |
+
},
|
| 220 |
+
"27": {
|
| 221 |
+
"content": "<|audio_end|>",
|
| 222 |
+
"lstrip": false,
|
| 223 |
+
"normalized": false,
|
| 224 |
+
"rstrip": false,
|
| 225 |
+
"single_word": false,
|
| 226 |
+
"special": true
|
| 227 |
+
},
|
| 228 |
+
"28": {
|
| 229 |
+
"content": "<tts_pad>",
|
| 230 |
+
"lstrip": false,
|
| 231 |
+
"normalized": false,
|
| 232 |
+
"rstrip": false,
|
| 233 |
+
"single_word": false,
|
| 234 |
+
"special": true
|
| 235 |
+
},
|
| 236 |
+
"29": {
|
| 237 |
+
"content": "<tts_text_bos>",
|
| 238 |
+
"lstrip": false,
|
| 239 |
+
"normalized": false,
|
| 240 |
+
"rstrip": false,
|
| 241 |
+
"single_word": false,
|
| 242 |
+
"special": true
|
| 243 |
+
},
|
| 244 |
+
"30": {
|
| 245 |
+
"content": "<tts_text_eod>",
|
| 246 |
+
"lstrip": false,
|
| 247 |
+
"normalized": false,
|
| 248 |
+
"rstrip": false,
|
| 249 |
+
"single_word": false,
|
| 250 |
+
"special": true
|
| 251 |
+
},
|
| 252 |
+
"31": {
|
| 253 |
+
"content": "<tts_text_bos_single>",
|
| 254 |
+
"lstrip": false,
|
| 255 |
+
"normalized": false,
|
| 256 |
+
"rstrip": false,
|
| 257 |
+
"single_word": false,
|
| 258 |
+
"special": true
|
| 259 |
+
},
|
| 260 |
+
"32": {
|
| 261 |
+
"content": "<non_speech>",
|
| 262 |
+
"lstrip": false,
|
| 263 |
+
"normalized": false,
|
| 264 |
+
"rstrip": false,
|
| 265 |
+
"single_word": false,
|
| 266 |
+
"special": true
|
| 267 |
+
},
|
| 268 |
+
"33": {
|
| 269 |
+
"content": "<|audio_pad|>",
|
| 270 |
+
"lstrip": false,
|
| 271 |
+
"normalized": false,
|
| 272 |
+
"rstrip": false,
|
| 273 |
+
"single_word": false,
|
| 274 |
+
"special": true
|
| 275 |
+
},
|
| 276 |
+
"34": {
|
| 277 |
+
"content": "<blank1>",
|
| 278 |
+
"lstrip": false,
|
| 279 |
+
"normalized": false,
|
| 280 |
+
"rstrip": false,
|
| 281 |
+
"single_word": false,
|
| 282 |
+
"special": true
|
| 283 |
+
},
|
| 284 |
+
"35": {
|
| 285 |
+
"content": "<blank2>",
|
| 286 |
+
"lstrip": false,
|
| 287 |
+
"normalized": false,
|
| 288 |
+
"rstrip": false,
|
| 289 |
+
"single_word": false,
|
| 290 |
+
"special": true
|
| 291 |
+
},
|
| 292 |
+
"36": {
|
| 293 |
+
"content": "<blank3>",
|
| 294 |
+
"lstrip": false,
|
| 295 |
+
"normalized": false,
|
| 296 |
+
"rstrip": false,
|
| 297 |
+
"single_word": false,
|
| 298 |
+
"special": true
|
| 299 |
+
},
|
| 300 |
+
"37": {
|
| 301 |
+
"content": "<blank4>",
|
| 302 |
+
"lstrip": false,
|
| 303 |
+
"normalized": false,
|
| 304 |
+
"rstrip": false,
|
| 305 |
+
"single_word": false,
|
| 306 |
+
"special": true
|
| 307 |
+
},
|
| 308 |
+
"38": {
|
| 309 |
+
"content": "<blank5>",
|
| 310 |
+
"lstrip": false,
|
| 311 |
+
"normalized": false,
|
| 312 |
+
"rstrip": false,
|
| 313 |
+
"single_word": false,
|
| 314 |
+
"special": true
|
| 315 |
+
},
|
| 316 |
+
"39": {
|
| 317 |
+
"content": "<blank6>",
|
| 318 |
+
"lstrip": false,
|
| 319 |
+
"normalized": false,
|
| 320 |
+
"rstrip": false,
|
| 321 |
+
"single_word": false,
|
| 322 |
+
"special": true
|
| 323 |
+
},
|
| 324 |
+
"40": {
|
| 325 |
+
"content": "<blank7>",
|
| 326 |
+
"lstrip": false,
|
| 327 |
+
"normalized": false,
|
| 328 |
+
"rstrip": false,
|
| 329 |
+
"single_word": false,
|
| 330 |
+
"special": true
|
| 331 |
+
},
|
| 332 |
+
"41": {
|
| 333 |
+
"content": "<blank8>",
|
| 334 |
+
"lstrip": false,
|
| 335 |
+
"normalized": false,
|
| 336 |
+
"rstrip": false,
|
| 337 |
+
"single_word": false,
|
| 338 |
+
"special": true
|
| 339 |
+
},
|
| 340 |
+
"42": {
|
| 341 |
+
"content": "<blank9>",
|
| 342 |
+
"lstrip": false,
|
| 343 |
+
"normalized": false,
|
| 344 |
+
"rstrip": false,
|
| 345 |
+
"single_word": false,
|
| 346 |
+
"special": true
|
| 347 |
+
},
|
| 348 |
+
"43": {
|
| 349 |
+
"content": "<blank10>",
|
| 350 |
+
"lstrip": false,
|
| 351 |
+
"normalized": false,
|
| 352 |
+
"rstrip": false,
|
| 353 |
+
"single_word": false,
|
| 354 |
+
"special": true
|
| 355 |
+
},
|
| 356 |
+
"44": {
|
| 357 |
+
"content": "<blank11>",
|
| 358 |
+
"lstrip": false,
|
| 359 |
+
"normalized": false,
|
| 360 |
+
"rstrip": false,
|
| 361 |
+
"single_word": false,
|
| 362 |
+
"special": true
|
| 363 |
+
},
|
| 364 |
+
"45": {
|
| 365 |
+
"content": "<blank12>",
|
| 366 |
+
"lstrip": false,
|
| 367 |
+
"normalized": false,
|
| 368 |
+
"rstrip": false,
|
| 369 |
+
"single_word": false,
|
| 370 |
+
"special": true
|
| 371 |
+
},
|
| 372 |
+
"46": {
|
| 373 |
+
"content": "<blank13>",
|
| 374 |
+
"lstrip": false,
|
| 375 |
+
"normalized": false,
|
| 376 |
+
"rstrip": false,
|
| 377 |
+
"single_word": false,
|
| 378 |
+
"special": true
|
| 379 |
+
},
|
| 380 |
+
"47": {
|
| 381 |
+
"content": "<blank14>",
|
| 382 |
+
"lstrip": false,
|
| 383 |
+
"normalized": false,
|
| 384 |
+
"rstrip": false,
|
| 385 |
+
"single_word": false,
|
| 386 |
+
"special": true
|
| 387 |
+
},
|
| 388 |
+
"48": {
|
| 389 |
+
"content": "<blank15>",
|
| 390 |
+
"lstrip": false,
|
| 391 |
+
"normalized": false,
|
| 392 |
+
"rstrip": false,
|
| 393 |
+
"single_word": false,
|
| 394 |
+
"special": true
|
| 395 |
+
},
|
| 396 |
+
"49": {
|
| 397 |
+
"content": "<blank16>",
|
| 398 |
+
"lstrip": false,
|
| 399 |
+
"normalized": false,
|
| 400 |
+
"rstrip": false,
|
| 401 |
+
"single_word": false,
|
| 402 |
+
"special": true
|
| 403 |
+
},
|
| 404 |
+
"50": {
|
| 405 |
+
"content": "<blank17>",
|
| 406 |
+
"lstrip": false,
|
| 407 |
+
"normalized": false,
|
| 408 |
+
"rstrip": false,
|
| 409 |
+
"single_word": false,
|
| 410 |
+
"special": true
|
| 411 |
+
},
|
| 412 |
+
"51": {
|
| 413 |
+
"content": "<blank18>",
|
| 414 |
+
"lstrip": false,
|
| 415 |
+
"normalized": false,
|
| 416 |
+
"rstrip": false,
|
| 417 |
+
"single_word": false,
|
| 418 |
+
"special": true
|
| 419 |
+
},
|
| 420 |
+
"52": {
|
| 421 |
+
"content": "<blank19>",
|
| 422 |
+
"lstrip": false,
|
| 423 |
+
"normalized": false,
|
| 424 |
+
"rstrip": false,
|
| 425 |
+
"single_word": false,
|
| 426 |
+
"special": true
|
| 427 |
+
},
|
| 428 |
+
"53": {
|
| 429 |
+
"content": "<blank20>",
|
| 430 |
+
"lstrip": false,
|
| 431 |
+
"normalized": false,
|
| 432 |
+
"rstrip": false,
|
| 433 |
+
"single_word": false,
|
| 434 |
+
"special": true
|
| 435 |
+
},
|
| 436 |
+
"54": {
|
| 437 |
+
"content": "<blank21>",
|
| 438 |
+
"lstrip": false,
|
| 439 |
+
"normalized": false,
|
| 440 |
+
"rstrip": false,
|
| 441 |
+
"single_word": false,
|
| 442 |
+
"special": true
|
| 443 |
+
},
|
| 444 |
+
"55": {
|
| 445 |
+
"content": "<blank22>",
|
| 446 |
+
"lstrip": false,
|
| 447 |
+
"normalized": false,
|
| 448 |
+
"rstrip": false,
|
| 449 |
+
"single_word": false,
|
| 450 |
+
"special": true
|
| 451 |
+
},
|
| 452 |
+
"56": {
|
| 453 |
+
"content": "<blank23>",
|
| 454 |
+
"lstrip": false,
|
| 455 |
+
"normalized": false,
|
| 456 |
+
"rstrip": false,
|
| 457 |
+
"single_word": false,
|
| 458 |
+
"special": true
|
| 459 |
+
},
|
| 460 |
+
"57": {
|
| 461 |
+
"content": "<blank24>",
|
| 462 |
+
"lstrip": false,
|
| 463 |
+
"normalized": false,
|
| 464 |
+
"rstrip": false,
|
| 465 |
+
"single_word": false,
|
| 466 |
+
"special": true
|
| 467 |
+
},
|
| 468 |
+
"58": {
|
| 469 |
+
"content": "<blank25>",
|
| 470 |
+
"lstrip": false,
|
| 471 |
+
"normalized": false,
|
| 472 |
+
"rstrip": false,
|
| 473 |
+
"single_word": false,
|
| 474 |
+
"special": true
|
| 475 |
+
},
|
| 476 |
+
"59": {
|
| 477 |
+
"content": "<blank26>",
|
| 478 |
+
"lstrip": false,
|
| 479 |
+
"normalized": false,
|
| 480 |
+
"rstrip": false,
|
| 481 |
+
"single_word": false,
|
| 482 |
+
"special": true
|
| 483 |
+
},
|
| 484 |
+
"60": {
|
| 485 |
+
"content": "<blank27>",
|
| 486 |
+
"lstrip": false,
|
| 487 |
+
"normalized": false,
|
| 488 |
+
"rstrip": false,
|
| 489 |
+
"single_word": false,
|
| 490 |
+
"special": true
|
| 491 |
+
},
|
| 492 |
+
"61": {
|
| 493 |
+
"content": "<asr_text>",
|
| 494 |
+
"lstrip": false,
|
| 495 |
+
"normalized": false,
|
| 496 |
+
"rstrip": false,
|
| 497 |
+
"single_word": false,
|
| 498 |
+
"special": true
|
| 499 |
+
}
|
| 500 |
+
},
|
| 501 |
+
"audio_bos_token": "<|audio_start|>",
|
| 502 |
+
"audio_eos_token": "<|audio_end|>",
|
| 503 |
+
"audio_token": "<|audio_pad|>",
|
| 504 |
+
"bos_token": null,
|
| 505 |
+
"clean_up_tokenization_spaces": false,
|
| 506 |
+
"eos_token": "<|im_end|>",
|
| 507 |
+
"extra_special_tokens": {
|
| 508 |
+
"audio_bos_token": "<|audio_start|>",
|
| 509 |
+
"audio_eos_token": "<|audio_end|>",
|
| 510 |
+
"audio_token": "<|audio_pad|>"
|
| 511 |
+
},
|
| 512 |
+
"fix_mistral_regex": true,
|
| 513 |
+
"model_max_length": 131072,
|
| 514 |
+
"pad_token": "<|endoftext|>",
|
| 515 |
+
"processor_class": "Qwen3ASRProcessor",
|
| 516 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 517 |
+
"unk_token": null
|
| 518 |
+
}
|
transcribe.py
DELETED
|
@@ -1,197 +0,0 @@
|
|
| 1 |
-
#!/usr/bin/env python3
|
| 2 |
-
"""Transcribe audio with Qwen3-ASR Darija GGUF via a running llama-server.
|
| 3 |
-
|
| 4 |
-
Start the server first:
|
| 5 |
-
|
| 6 |
-
llama-server \
|
| 7 |
-
-m qwen3-asr-darija-0.6b-Q4_K_M.gguf \
|
| 8 |
-
--mmproj mmproj-qwen3-asr-darija-0.6b-BF16.gguf \
|
| 9 |
-
--no-mmproj-offload -ngl 0 -c 8192 \
|
| 10 |
-
--host 127.0.0.1 --port 8080
|
| 11 |
-
|
| 12 |
-
Then:
|
| 13 |
-
|
| 14 |
-
python3 transcribe.py --audio sample.wav
|
| 15 |
-
python3 transcribe.py --input-jsonl clips.jsonl --output results.jsonl
|
| 16 |
-
"""
|
| 17 |
-
|
| 18 |
-
from __future__ import annotations
|
| 19 |
-
|
| 20 |
-
import argparse
|
| 21 |
-
import base64
|
| 22 |
-
import json
|
| 23 |
-
import re
|
| 24 |
-
import sys
|
| 25 |
-
import urllib.request
|
| 26 |
-
from pathlib import Path
|
| 27 |
-
from typing import Any
|
| 28 |
-
|
| 29 |
-
PROMPT = "Transcribe the speech in the original language."
|
| 30 |
-
|
| 31 |
-
# The model emits "language <Name>" followed by the transcript. llama-mtmd-cli
|
| 32 |
-
# inserts an <asr_text> marker between the two; the llama-server chat endpoint does
|
| 33 |
-
# not. The language name is ASCII, so match [A-Za-z]+ to avoid swallowing the first
|
| 34 |
-
# word of the transcript.
|
| 35 |
-
ASR_OUTPUT_RE = re.compile(r"language\s+([A-Za-z]+)\s*(?:<asr_text>)?\s*(.*)", re.DOTALL)
|
| 36 |
-
|
| 37 |
-
try:
|
| 38 |
-
from asr_guards import has_speech, scrub_hallucination
|
| 39 |
-
except ImportError: # allow running from another cwd if asr_guards.py is beside this file
|
| 40 |
-
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
| 41 |
-
from asr_guards import has_speech, scrub_hallucination
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
def parse_output(raw: str) -> dict[str, Any]:
|
| 45 |
-
raw = raw.strip()
|
| 46 |
-
match = ASR_OUTPUT_RE.search(raw)
|
| 47 |
-
if match:
|
| 48 |
-
language, transcription = match.group(1), match.group(2).strip()
|
| 49 |
-
else:
|
| 50 |
-
language, transcription = None, raw
|
| 51 |
-
scrubbed = scrub_hallucination(transcription)
|
| 52 |
-
row = {"language": language, "transcription": scrubbed, "raw": raw}
|
| 53 |
-
if scrubbed != transcription:
|
| 54 |
-
row["suppressed"] = "known_hallucination"
|
| 55 |
-
return row
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
def default_model(base_url: str, timeout: int) -> str:
|
| 59 |
-
req = urllib.request.Request(base_url.rstrip("/") + "/v1/models")
|
| 60 |
-
with urllib.request.urlopen(req, timeout=timeout) as resp:
|
| 61 |
-
payload = json.load(resp)
|
| 62 |
-
entries = payload.get("data") or payload.get("models") or []
|
| 63 |
-
if not entries:
|
| 64 |
-
raise RuntimeError("Server returned no models")
|
| 65 |
-
first = entries[0]
|
| 66 |
-
return first.get("id") if isinstance(first, dict) else str(first)
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
def transcribe(base_url: str, wav: Path, model: str, *, max_tokens: int, timeout: int) -> str:
|
| 70 |
-
audio_b64 = base64.standard_b64encode(wav.read_bytes()).decode("ascii")
|
| 71 |
-
body = json.dumps(
|
| 72 |
-
{
|
| 73 |
-
"model": model,
|
| 74 |
-
"messages": [
|
| 75 |
-
{
|
| 76 |
-
"role": "user",
|
| 77 |
-
"content": [
|
| 78 |
-
{
|
| 79 |
-
"type": "input_audio",
|
| 80 |
-
"input_audio": {"data": audio_b64, "format": "wav"},
|
| 81 |
-
},
|
| 82 |
-
{"type": "text", "text": PROMPT},
|
| 83 |
-
],
|
| 84 |
-
}
|
| 85 |
-
],
|
| 86 |
-
"temperature": 0.0,
|
| 87 |
-
"max_tokens": max_tokens,
|
| 88 |
-
}
|
| 89 |
-
).encode("utf-8")
|
| 90 |
-
|
| 91 |
-
req = urllib.request.Request(
|
| 92 |
-
base_url.rstrip("/") + "/v1/chat/completions",
|
| 93 |
-
data=body,
|
| 94 |
-
method="POST",
|
| 95 |
-
headers={"Content-Type": "application/json"},
|
| 96 |
-
)
|
| 97 |
-
with urllib.request.urlopen(req, timeout=timeout) as resp:
|
| 98 |
-
payload = json.load(resp)
|
| 99 |
-
|
| 100 |
-
choices = payload.get("choices") or []
|
| 101 |
-
if not choices:
|
| 102 |
-
raise RuntimeError(f"No choices in response: {payload!r}")
|
| 103 |
-
return (choices[0].get("message") or {}).get("content") or ""
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
def collect_inputs(args: argparse.Namespace) -> list[Path]:
|
| 107 |
-
if bool(args.audio) == bool(args.input_jsonl):
|
| 108 |
-
raise SystemExit("Pass exactly one of --audio or --input-jsonl")
|
| 109 |
-
|
| 110 |
-
if args.audio:
|
| 111 |
-
wav = args.audio.expanduser()
|
| 112 |
-
if not wav.is_file():
|
| 113 |
-
raise SystemExit(f"Audio not found: {wav}")
|
| 114 |
-
return [wav]
|
| 115 |
-
|
| 116 |
-
paths: list[Path] = []
|
| 117 |
-
with args.input_jsonl.expanduser().open(encoding="utf-8") as handle:
|
| 118 |
-
for number, line in enumerate(handle, start=1):
|
| 119 |
-
line = line.strip()
|
| 120 |
-
if not line:
|
| 121 |
-
continue
|
| 122 |
-
field = json.loads(line).get("audio")
|
| 123 |
-
if not field:
|
| 124 |
-
raise SystemExit(f"Line {number}: missing 'audio' field")
|
| 125 |
-
wav = Path(field).expanduser()
|
| 126 |
-
if not wav.is_file():
|
| 127 |
-
raise SystemExit(f"Line {number}: audio not found: {wav}")
|
| 128 |
-
paths.append(wav)
|
| 129 |
-
return paths
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
def main() -> int:
|
| 133 |
-
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
| 134 |
-
parser.add_argument("--audio", type=Path, help="Single audio file")
|
| 135 |
-
parser.add_argument("--input-jsonl", type=Path, help="JSONL with an 'audio' path per line")
|
| 136 |
-
parser.add_argument("--output", type=Path, help="Write JSONL results here instead of stdout")
|
| 137 |
-
parser.add_argument("--base-url", default="http://127.0.0.1:8080")
|
| 138 |
-
parser.add_argument("--model", default=None, help="Model id (default: first from /v1/models)")
|
| 139 |
-
parser.add_argument("--max-tokens", type=int, default=512)
|
| 140 |
-
parser.add_argument("--timeout", type=int, default=600)
|
| 141 |
-
parser.add_argument(
|
| 142 |
-
"--require-speech",
|
| 143 |
-
action="store_true",
|
| 144 |
-
help="Skip ASR when Silero VAD finds no speech (silence/music). Needs models/silero_vad.onnx",
|
| 145 |
-
)
|
| 146 |
-
args = parser.parse_args()
|
| 147 |
-
|
| 148 |
-
wavs = collect_inputs(args)
|
| 149 |
-
|
| 150 |
-
try:
|
| 151 |
-
model = args.model or default_model(args.base_url, timeout=10)
|
| 152 |
-
except Exception as exc:
|
| 153 |
-
raise SystemExit(f"Cannot reach llama-server at {args.base_url}: {exc}") from exc
|
| 154 |
-
|
| 155 |
-
results: list[dict[str, Any]] = []
|
| 156 |
-
failures = 0
|
| 157 |
-
for index, wav in enumerate(wavs, start=1):
|
| 158 |
-
try:
|
| 159 |
-
if args.require_speech and not has_speech(wav):
|
| 160 |
-
row = {
|
| 161 |
-
"audio": str(wav),
|
| 162 |
-
"language": None,
|
| 163 |
-
"transcription": "",
|
| 164 |
-
"raw": None,
|
| 165 |
-
"suppressed": "no_speech",
|
| 166 |
-
}
|
| 167 |
-
print(f"[{index}/{len(wavs)}] skip {wav.name} (no speech)", file=sys.stderr)
|
| 168 |
-
results.append(row)
|
| 169 |
-
continue
|
| 170 |
-
raw = transcribe(
|
| 171 |
-
args.base_url, wav, model, max_tokens=args.max_tokens, timeout=args.timeout
|
| 172 |
-
)
|
| 173 |
-
row = {"audio": str(wav), **parse_output(raw)}
|
| 174 |
-
note = f" suppressed={row['suppressed']}" if row.get("suppressed") else ""
|
| 175 |
-
print(f"[{index}/{len(wavs)}] ok {wav.name}{note}", file=sys.stderr)
|
| 176 |
-
except Exception as exc:
|
| 177 |
-
failures += 1
|
| 178 |
-
row = {"audio": str(wav), "language": None, "transcription": None, "error": str(exc)}
|
| 179 |
-
print(f"[{index}/{len(wavs)}] FAIL {wav.name}: {exc}", file=sys.stderr)
|
| 180 |
-
results.append(row)
|
| 181 |
-
|
| 182 |
-
if args.output:
|
| 183 |
-
with args.output.expanduser().open("w", encoding="utf-8") as handle:
|
| 184 |
-
for row in results:
|
| 185 |
-
handle.write(json.dumps(row, ensure_ascii=False) + "\n")
|
| 186 |
-
print(f"Wrote {args.output}", file=sys.stderr)
|
| 187 |
-
elif len(results) == 1:
|
| 188 |
-
print(results[0]["transcription"] or "")
|
| 189 |
-
else:
|
| 190 |
-
for row in results:
|
| 191 |
-
print(json.dumps(row, ensure_ascii=False))
|
| 192 |
-
|
| 193 |
-
return 1 if failures else 0
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
if __name__ == "__main__":
|
| 197 |
-
raise SystemExit(main())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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