Speech to Text with NVIDIA Riva ASR NIM
NVIDIA Riva ASR NIM APIs provide seamless access to state-of-the-art Automatic Speech Recognition (ASR) models supporting multiple languages. Built on NVIDIA's software platform, these models leverage CUDA, TensorRT, and Triton to offer out-of-the-box GPU acceleration for high-performance speech transcription. This tutorial is based on:
NVIDIA official documentation: https://docs.nvidia.com/nim/riva/asr/latest/getting-started.html.
NGC container image: https://catalog.ngc.nvidia.com/orgs/nim/teams/nvidia/containers/parakeet-ctc-1.1b-asr?version=1.0.0.
NVIDIA model card: https://build.nvidia.com/nvidia/parakeet-ctc-1_1b-asr/modelcard.
Step 1 - NGC Authentication
Since Riva ASR NIM is a self-hosted NVIDIA Inference Micro-service (NIM) available under the NVIDIA AI Enterprise (NVAIE) License, an NGC API key is required.
Note: This requires a Personal Key, different from the Legacy Key used in Enroot configurations.
For Enroot setup, refer to: DGX On-Prem How-To
To generate your NGC API Personal Key, visit: Generate Personal Key. When creating your key, make sure to select “NGC Catalog” under the “Services Included” dropdown. Additional services can be included if the key will be reused for other purposes. For detailed information on API key types: https://docs.nvidia.com/ngc/gpu-cloud/ngc-user-guide/index.html#ngc-api-keys. The key will have a prefix nvapi-. Keep it securely, as it will be used in the next step.
Step 2 - Launching the NIM
The official NVIDIA documentation provides Docker-based instructions, but since DGX environments use Enroot as the container runtime, a SLURM script is needed to translate Docker parameters to the appropriate Pyxis/Enroot flags. Below is a template SLURM script to launch the Riva ASR NIM.
#!/bin/bash
#SBATCH --job-name=parakeet
#SBATCH --output=%j.out
#SBATCH --time=8:00:00
#SBATCH --gpus=1
#SBATCH --container-image='docker://nvcr.io/nim/nvidia/parakeet-1-1b-ctc-en-us:1.3.0'
#SBATCH --container-mounts=/network/rit/dgx/dgx_YOUR_LAB_NAME:/mnt/dgx_lab,/network/rit/lab/YOUR_LAB_NAME:/mnt/lab
#SBATCH --container-writable
# SLURM Parameters
SLURM_NODE_NAME="$SLURMD_NODENAME"
SLURM_JOB_ID="$SLURM_JOB_ID"
# NIM API Ports
NIM_HTTP_API_PORT=9000
NIM_GRPC_API_PORT=50051
# Construct URLs
NIM_HTTP_API_URL="http://${SLURM_NODE_NAME}.its.albany.edu:${NIM_HTTP_API_PORT}"
NIM_GRPC_API_URL="${SLURM_NODE_NAME}.its.albany.edu:${NIM_GRPC_API_PORT}"
# Prepare Demo Folder
DEMO_DIR="/mnt/dgx_lab/parakeet_demo"
mkdir -p ${DEMO_DIR}/python-clients
# Clone Riva Python client repository
git clone https://github.com/nvidia-riva/python-clients.git ${DEMO_DIR}/python-clients
# Copy example audio file from container
cp /opt/riva/wav/en-US_sample.wav ${DEMO_DIR}/
# Display URLs and job info
echo -e "\n================================================================================\n"
echo -e "SLURM Job ID ${SLURM_JOB_ID} running on ${SLURM_NODE_NAME}\n"
echo -e "HTTP URL: ${NIM_HTTP_API_URL}\n"
echo -e "GRPC URL: ${NIM_GRPC_API_URL}"
echo -e "\n================================================================================\n"
# Set NGC API Key (replace YOUR_API_KEY with your actual API key)
export NGC_API_KEY="YOUR_API_KEY"
# Model Profile
export NIM_TAGS_SELECTOR="name=parakeet-1-1b-ctc-en-us,mode=all"
# Start the NIM server
sh /opt/nim/start_server.shYou can copy the contents from this snippet and save it as parakeet.slurm or you can simply download it from here: .
Connect to the DGX On-Prem cluster over SSH (
ssh your_netid@dgx-head01.its.albany.edu). If off-campus, ensure VPN is connected before logging in.Download and edit the above SLURM script for your use:
Replace
YOUR_LAB_NAMEwith your lab's actual name.Replace
YOUR_API_KEYwith the NGC API key (includingnvapi-prefix).
Submit the job to SLURM (
sbatch parakeet.slurm). SLURM will assign and queue your job according to resource availability.Monitor job status (
squeue -u YOUR_NETID).Watch job progress by checking the output file (
tail -f YOUR_JOB_ID.out). Look for an entry similar to the following, as you will use the URLs on the next step.
================================================================================
SLURM Job ID 22941 running on dgx04
HTTP URL: http://dgx04.its.albany.edu:9000
GRPC URL: dgx04.its.albany.edu:50051
================================================================================Step 3 - Running Inference
This NIM runs the Parakeet 1.1b ASR model, which transcribes spoken English into lowercase text. Within the demo directory (e.g., /mnt/dgx_lab/parakeet_demo), the python-clients folder contains Python scripts to ease interaction with the service. On this demo, we will be using the following sample file.
Using The gRPC API
On your local machine, navigate or copy the
python-clientsdirectory and install required Python dependencies (pip install -U nvidia-riva-client)Test connectivity and list available models (replace
dgx04.its.albany.edu:50051with your GRPC URL):
python3 ./scripts/asr/transcribe_file.py \
--server dgx04.its.albany.edu:50051 \
--list-modelsExpected output example:
Available ASR models
{'en-US': [{'model': ['parakeet-1.1b-en-US-asr-streaming']}]}Run a transcription example on the included sample audio:
python3 ./scripts/asr/transcribe_file.py \
--server dgx04.its.albany.edu:50051 \
--language-code en-US --automatic-punctuation \
--input-file en-US_sample.wavExpected transcription output:
What is natural language processing?Using The HTTP API
On your local machine, navigate or copy the
en-US_sample.wavfile from thepython-clientsdirectoryRun a transcription example (replace
http://dgx04.its.albany.edu:9000with your HTTP URL) on the included sample audio (make sure you’re in the same directory of the .wav file):
curl http://dgx04.its.albany.edu:9000/v1/audio/transcriptions -F language="en-US" -F file="@en-US_sample.wav”Expected transcription output:
{"text":"What is natural language processing?"}Explore the official documentation for more details and parameters: https://docs.nvidia.com/nim/riva/asr/latest/getting-started.html#running-inference. This tutorial provides a solid foundation to get started with NVIDIA Riva ASR using NIM on DGX systems. Feel free to experiment with client parameters and models to tailor the ASR experience to your needs.