Automatic Speech Recognition
PEFT
Safetensors
English
whisper
lora
audio
machine-sound
anomaly-detection
predictive-maintenance
manufacturing
voice-agent
text-to-speech
non-commercial
Eval Results (legacy)
Instructions to use muruganmath/Machine-fault-detector with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use muruganmath/Machine-fault-detector with PEFT:
from peft import PeftModel from transformers import AutoModelForSpeechSeq2Seq base_model = AutoModelForSpeechSeq2Seq.from_pretrained("openai/whisper-large-v3") model = PeftModel.from_pretrained(base_model, "muruganmath/Machine-fault-detector") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -50,6 +50,45 @@ model-index:
|
|
| 50 |
|
| 51 |
# Model card: whisper-large-v3 + LoRA "main" (machine-sound adapter) and voice agent
|
| 52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
| | |
|
| 54 |
|---|---|
|
| 55 |
| **Model** | `whisper_ft/out/whisper-lora/main/adapter`: LoRA adapter for `openai/whisper-large-v3` |
|
|
@@ -242,6 +281,52 @@ so there are no pauses between code characters.
|
|
| 242 |
|
| 243 |
## 6. How to run inference
|
| 244 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
Conda env `mfg_whisper`; run from `finetune_whisper/`.
|
| 246 |
|
| 247 |
```bash
|
|
|
|
| 50 |
|
| 51 |
# Model card: whisper-large-v3 + LoRA "main" (machine-sound adapter) and voice agent
|
| 52 |
|
| 53 |
+
## Summary
|
| 54 |
+
|
| 55 |
+
This model is a LoRA adapter for OpenAI's Whisper large-v3. It teaches Whisper to **describe industrial
|
| 56 |
+
machine sounds** as structured text instead of transcribing speech. Given a 10-second clip, it outputs a
|
| 57 |
+
line such as `machine: fan; condition: high load; status: anomalous; fault: overheating; noise: low noise`.
|
| 58 |
+
Engine clips get an RPM and torque estimate instead. It still transcribes English speech as well as the
|
| 59 |
+
original model.
|
| 60 |
+
|
| 61 |
+
A companion voice agent puts it behind a phone line (Azure Communication Services media stream), a browser
|
| 62 |
+
microphone, or file upload. Speech gets a spoken read-back ("I heard: …"), and machine sounds get a spoken
|
| 63 |
+
diagnosis ("Sound check. This is a fan under high load. It sounds abnormal. Possible fault: overheating.").
|
| 64 |
+
Speech recognition and synthesis run locally, with no cloud AI services.
|
| 65 |
+
|
| 66 |
+
**Training**
|
| 67 |
+
- **Data:** about 24,500 clips (70 h). 20,000 come from AnomalyMachine-50K (6 machine types, 3 load
|
| 68 |
+
conditions, 5 fault types, 4 noise levels, balanced normal/anomalous) and 4,497 from Procedural Engine
|
| 69 |
+
Sounds. **Both datasets are synthetic**, and neither contains speech.
|
| 70 |
+
- **Method:** LoRA (r 32, alpha 64) on all attention and feed-forward layers of the encoder and decoder,
|
| 71 |
+
with the base model frozen in 8-bit.
|
| 72 |
+
- 3 epochs, effective batch 32, learning rate 1e-4 with cosine decay.
|
| 73 |
+
- 9 hours on one RTX 5070 (12 GB).
|
| 74 |
+
- **Results:** measured on a 600-clip validation subset ([§5](#5-evaluation)):
|
| 75 |
+
|
| 76 |
+
| Metric | Value |
|
| 77 |
+
|---|---|
|
| 78 |
+
| Template WER | 0.185 |
|
| 79 |
+
| Exact template match | 22% |
|
| 80 |
+
| Mean per-field accuracy | 60% |
|
| 81 |
+
| Normal/anomalous F1 | 1.00 |
|
| 82 |
+
|
| 83 |
+
The test split has not been evaluated yet.
|
| 84 |
+
|
| 85 |
+
**Limits:** it is untested on real machines, real microphones or real operators. Engine RPM and torque
|
| 86 |
+
estimates are unreliable, and spoken alarm codes can be misread ([§7](#7-limitations-and-risks)). It is a
|
| 87 |
+
research prototype and **non-commercial only**, because both the engine training data and the voice model
|
| 88 |
+
are CC-BY-NC-4.0 ([§9](#9-licences)).
|
| 89 |
+
|
| 90 |
+
---
|
| 91 |
+
|
| 92 |
| | |
|
| 93 |
|---|---|
|
| 94 |
| **Model** | `whisper_ft/out/whisper-lora/main/adapter`: LoRA adapter for `openai/whisper-large-v3` |
|
|
|
|
| 281 |
|
| 282 |
## 6. How to run inference
|
| 283 |
|
| 284 |
+
### 6.1 Quick start: audio file in → voice file out
|
| 285 |
+
|
| 286 |
+
One command creates the environment on its first run (skipping steps already done), then answers the
|
| 287 |
+
audio with a spoken reply: [run_voice_inference.sh](run_voice_inference.sh).
|
| 288 |
+
|
| 289 |
+
```bash
|
| 290 |
+
cd finetune_whisper
|
| 291 |
+
bash run_voice_inference.sh recording/section_00_source_test_anomaly_0021.wav
|
| 292 |
+
```
|
| 293 |
+
|
| 294 |
+
Output (verified 2026-11-12):
|
| 295 |
+
|
| 296 |
+
```
|
| 297 |
+
[ 0.0- 10.0s] heard: machine sound: machine: fan; condition: high load; status: anomalous; fault: overheating; noise: low noise
|
| 298 |
+
reply: Sound check. This is a fan under high load. It sounds abnormal. Possible fault: overheating. The recording has low background noise.
|
| 299 |
+
{"segments": 1, "spoken": 1, "skipped": 0, "reply_s": 11.02, "out_wav": ".../out/speak/section_00_source_test_anomaly_0021_reply.wav"}
|
| 300 |
+
```
|
| 301 |
+
|
| 302 |
+
The voice reply is in `out/speak/<audio name>_reply.wav`. For speech, the output is `heard: <transcript>`
|
| 303 |
+
and `reply: I heard: <transcript>`.
|
| 304 |
+
|
| 305 |
+
### 6.2 The same steps by hand
|
| 306 |
+
|
| 307 |
+
```bash
|
| 308 |
+
cd finetune_whisper
|
| 309 |
+
|
| 310 |
+
# 1. Python environment (once)
|
| 311 |
+
conda create -n mfg_whisper python=3.11 -y
|
| 312 |
+
conda activate mfg_whisper
|
| 313 |
+
pip install torch # PyPI wheel supports RTX 50-series (sm_120)
|
| 314 |
+
pip install -r requirements.txt
|
| 315 |
+
|
| 316 |
+
# 2. Models (once): base Whisper (~3 GB, pinned revision) and the TTS voice (~145 MB)
|
| 317 |
+
python scripts/download_model.py --no-xet
|
| 318 |
+
python scripts/download_tts_model.py --no-xet
|
| 319 |
+
# The adapter whisper_ft/out/whisper-lora/main/adapter comes from training (whisper_ft/README.md).
|
| 320 |
+
|
| 321 |
+
# 3. Audio file → Whisper + adapter → text → TTS → voice file
|
| 322 |
+
python speak_transcript.py recording/section_00_source_test_anomaly_0021.wav --show
|
| 323 |
+
# options: --out-wav reply.wav --out-json reply.json (texts, mode 0600)
|
| 324 |
+
# --reply-prefix "" (speak the transcript without "I heard:")
|
| 325 |
+
# --adapter "" (stock Whisper: no machine-sound diagnosis)
|
| 326 |
+
```
|
| 327 |
+
|
| 328 |
+
### 6.3 Other entry points
|
| 329 |
+
|
| 330 |
Conda env `mfg_whisper`; run from `finetune_whisper/`.
|
| 331 |
|
| 332 |
```bash
|