Monster-Code commited on
Commit
3319246
ยท
verified ยท
1 Parent(s): 7e065cc

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +160 -0
README.md ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: apache-2.0
5
+ library_name: transformers
6
+ tags:
7
+ - automatic-speech-recognition
8
+ - ctc
9
+ - audio
10
+ - pytorch
11
+ - speech-to-text
12
+ datasets:
13
+ - librispeech_asr
14
+ metrics:
15
+ - wer
16
+ model-index:
17
+ - name: Jalapeno-ASR-preview
18
+ results: []
19
+ ---
20
+
21
+ # ๐ŸŒถ๏ธ Jalapeno-ASR-preview
22
+
23
+ **Jalapeno-ASR-preview** is a lightweight, ultra-fast **25 Million Parameter CTC-based Automatic Speech Recognition (ASR)** model designed for English speech-to-text.
24
+
25
+ It prioritizes a minimal computational footprint and zero heavy language model dependencies, making it suitable for edge deployment, real-time transcription pipelines, and low-resource environments.
26
+
27
+ > โš ๏ธ **Notice**: This is an experimental **Step 25.5K preview release**. While acoustic feature extraction and alignment are highly functional, raw greedy outputs may exhibit minor phonetic spelling artifacts. Using **CTC Beam Search** decoding at inference time fixes the vast majority of these alignment errors without adding neural model parameters.
28
+
29
+ ---
30
+
31
+ ## ๐ŸŽ๏ธ Model Architecture & Specs
32
+
33
+ - **Model Type:** Connectionist Temporal Classification (CTC) Acoustic Model
34
+ - **Parameter Count:** ~25M Parameters (~100 MB weights)
35
+ - **Target Language:** English (`en`)
36
+ - **Primary Training Data:** LibriSpeech ASR
37
+ - **Input Format:** 16 kHz Mono Audio Waveforms
38
+ - **Inference RAM Overhead:** ~1โ€“2 MB (when paired with CTC Beam Search)
39
+
40
+ ---
41
+
42
+ ## ๐Ÿš€ Quickstart & Usage
43
+
44
+ ### 1. Simple Inference with Transformers (Greedy Decoding)
45
+
46
+ You can run simple greedy inference directly using Hugging Face `transformers`:
47
+
48
+ ```python
49
+ import torch
50
+ import torchaudio
51
+ from transformers import AutoModelForCTC, AutoProcessor
52
+
53
+ MODEL_ID = "Monster-Code/Jalapeno-ASR-preview"
54
+
55
+ # Load model and processor
56
+ processor = AutoProcessor.from_pretrained(MODEL_ID)
57
+ model = AutoModelForCTC.from_pretrained(MODEL_ID)
58
+ model.eval()
59
+
60
+ # Load and resample audio to 16kHz
61
+ waveform, sample_rate = torchaudio.load("sample.wav")
62
+ if sample_rate != 16000:
63
+ resampler = torchaudio.transforms.Resample(
64
+ orig_freq=sample_rate, new_freq=16000
65
+ )
66
+ waveform = resampler(waveform)
67
+
68
+ # Extract features & run model
69
+ inputs = processor(
70
+ waveform.squeeze(0), sampling_rate=16000, return_tensors="pt"
71
+ )
72
+ with torch.no_grad():
73
+ logits = model(inputs.input_values).logits
74
+
75
+ # Raw Greedy Argmax Decoding
76
+ predicted_ids = torch.argmax(logits, dim=-1)[0]
77
+ transcription = processor.decode(predicted_ids)
78
+
79
+ print("Greedy Output:", transcription)
80
+
81
+ ```
82
+
83
+ ---
84
+
85
+ ### 2. Standard Production Inference (CTC Beam Search)
86
+
87
+ For production accuracy, decode the logit output using **CTC Beam Search** with `pyctcdecode`. This prunes weak character paths and fixes phonetic typos without adding parameter bloat.
88
+
89
+ #### Installation
90
+
91
+ ```bash
92
+ pip install pyctcdecode transformers torch torchaudio
93
+
94
+ ```
95
+
96
+ #### Inference Code
97
+
98
+ ```python
99
+ import numpy as np
100
+ from pyctcdecode import build_ctcdecoder
101
+ import torch
102
+ import torchaudio
103
+ from transformers import AutoModelForCTC, AutoProcessor
104
+
105
+ MODEL_ID = "Monster-Code/Jalapeno-ASR-preview"
106
+
107
+ # 1. Load Model & Processor
108
+ processor = AutoProcessor.from_pretrained(MODEL_ID)
109
+ model = AutoModelForCTC.from_pretrained(MODEL_ID)
110
+ model.eval()
111
+
112
+ # 2. Build Beam Search Decoder from Tokenizer Vocabulary
113
+ labels = list(processor.tokenizer.get_vocab().keys())
114
+ decoder = build_ctcdecoder(labels=labels)
115
+
116
+ # 3. Process Audio
117
+ waveform, sample_rate = torchaudio.load("audio.wav")
118
+ if sample_rate != 16000:
119
+ resampler = torchaudio.transforms.Resample(
120
+ orig_freq=sample_rate, new_freq=16000
121
+ )
122
+ waveform = resampler(waveform)
123
+
124
+ inputs = processor(
125
+ waveform.squeeze(0), sampling_rate=16000, return_tensors="pt"
126
+ )
127
+
128
+ # 4. Neural Network Forward Pass
129
+ with torch.no_grad():
130
+ logits = model(inputs.input_values).logits # Shape: [1, T, Vocab]
131
+
132
+ # Convert logits to probability distribution
133
+ probs = torch.softmax(logits, dim=-1).squeeze(0).cpu().numpy()
134
+
135
+ # 5. Run CTC Beam Search (Width = 100)
136
+ beam_transcription = decoder.decode(probs, beam_width=100)
137
+
138
+ print("Beam Search Output:", beam_transcription)
139
+
140
+ ```
141
+
142
+ ---
143
+
144
+ ## ๐Ÿ“Š Evaluation & Checkpoint Status
145
+
146
+ At **Step 25.5K (CTC Loss: 0.4969)**, the model demonstrates strong phonetic acoustic mapping.
147
+
148
+ | Decoding Strategy | Example Output |
149
+ | --- | --- |
150
+ | **Ground Truth** | `the second in importance is as follows sovereignty may be defined...` |
151
+ | **Raw Greedy Output** | `the second in importance is is follows soveringdey be defind...` |
152
+ | **CTC Beam Search** | `the second in importance is as follows sovereignity may be defined...` |
153
+
154
+ ---
155
+
156
+ ## ๐Ÿ’ก Intended Use & Limitations
157
+
158
+ * **Optimal For:** Real-time speech recognition, embedded/edge execution, speech-to-command systems, microservices.
159
+ * **Limitations:** Pure CTC architectures lack native language modeling memory. For optimal accuracy on complex vocabulary or accented speech, always use CTC Prefix Beam Search during inference.
160
+