Add code snippet for nemo streaming inference
Browse files
README.md
CHANGED
|
@@ -269,7 +269,28 @@ Latency is defined by the `att_context_size` param, where att_context_size = `{
|
|
| 269 |
|
| 270 |
Here, chunk size = current frame + right context; each chunk is processed in non-overlapping fashion.
|
| 271 |
|
| 272 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
|
| 274 |
### Input
|
| 275 |
|
|
|
|
| 269 |
|
| 270 |
Here, chunk size = current frame + right context; each chunk is processed in non-overlapping fashion.
|
| 271 |
|
| 272 |
+
|
| 273 |
+
You can also run streaming inference through the pipeline method, which uses [this config](https://github.com/NVIDIA-NeMo/NeMo/blob/main/examples/asr/conf/asr_streaming_inference/cache_aware_rnnt.yaml) to build end‑to‑end workflows with punctuation and capitalization (PnC), inverse text normalization (ITN), and translation support
|
| 274 |
+
|
| 275 |
+
```python
|
| 276 |
+
from nemo.collections.asr.inference.factory.pipeline_builder import PipelineBuilder
|
| 277 |
+
from omegaconf import OmegaConf
|
| 278 |
+
|
| 279 |
+
# Path to the cache aware config file downloaded from above link
|
| 280 |
+
cfg_path = 'cache_aware_rnnt.yaml'
|
| 281 |
+
cfg = OmegaConf.load(cfg_path)
|
| 282 |
+
|
| 283 |
+
# Pass the paths of all the audio files for inferencing
|
| 284 |
+
audios = ['/path/to/your/audio.wav']
|
| 285 |
+
|
| 286 |
+
# Create the streaming pipeline inference builder object
|
| 287 |
+
pipeline = PipelineBuilder.build_pipeline(cfg)
|
| 288 |
+
output = pipeline.run(audios)
|
| 289 |
+
|
| 290 |
+
# Print the output
|
| 291 |
+
for entry in output:
|
| 292 |
+
print(entry['text'])
|
| 293 |
+
```
|
| 294 |
|
| 295 |
### Input
|
| 296 |
|