
Follow the steps below to download and run the NVIDIA NIM inference microservice for this model on your infrastructure of choice.
Generate API Key
Pull and Run the NIM
$ docker login nvcr.io Username: $oauthtoken Password: <PASTE_API_KEY_HERE>
NVIDIA Maxine BNR NIM uses gRPC APIs for inferencing requests.
A NGC API KEY is required to download the appropriate models and resources when starting the NIM.
If you are not familiar with how to create the NGC_API_KEY
environment variable, the simplest way is to export it in your terminal:
export NGC_API_KEY=<PASTE_API_KEY_HERE>
Run one of the following commands to make the key available at startup:
# If using bash echo "export NGC_API_KEY=<value>" >> ~/.bashrc # If using zsh echo "export NGC_API_KEY=<value>" >> ~/.zshrc
Other, more secure options include saving the value in a file, so that you can retrieve with cat $NGC_API_KEY_FILE
, or using a password manager.
The following command launches the Maxine BNR NIM container with the gRPC service. Find reference to runtime parameters for the container here.
docker run -it --rm --name=bnr \ --runtime=nvidia \ --gpus all \ --shm-size=8GB \ -e NGC_API_KEY=$NGC_API_KEY \ -e MAXINE_MAX_CONCURRENCY_PER_GPU=1 \ -e NIM_MODEL_PROFILE=<nim_model_profile> \ -e FILE_SIZE_LIMIT=36700160 \ -p 8000:8000 \ -p 8001:8001 \ nvcr.io/nim/nvidia/maxine-bnr:latest
Ensure you use the appropriate NIM_MODEL_PROFILE
for your GPU. For more information about NIM_MODEL_PROFILE
, refer to the the NIM Model Profile Table.
Please note, the flag --gpus all is used to assign all available GPUs to the docker container. This fails on multiple GPU unless all GPUs are same. To assign specific GPU to the docker container (in case of different multiple GPUs available in your machine) use --gpus '"device=0,1,2..."'
If the command runs successfully, you will get an output ending similar to the following:
I1126 09:22:21.048202 31 grpc_server.cc:2558] "Started GRPCInferenceService at 127.0.0.1:9001" I1126 09:22:21.048377 31 http_server.cc:4704] "Started HTTPService at 127.0.0.1:9000" I1126 09:22:21.089295 31 http_server.cc:362] "Started Metrics Service at 127.0.0.1:9002" Maxine GRPC Service: Listening to 0.0.0.0:8001
By default Maxine BNR gRPC service is hosted on port 8001
. You will have to use this port for inferencing requests.
Test the NIM
We have provided a sample client script file in our GitHub repo. The script could be used to invoke the Docker container using the following instructions.
Download the Maxine BNR Python client code by cloning the NVIDIA Maxine NIM Clients Repository:
git clone https://github.com/NVIDIA-Maxine/nim-clients cd nim-clients/bnr
Install the dependencies for the NVIDIA Maxine BNR Python client:
sudo apt-get install python3-pip pip install -r requirements.txt
Go to scripts directory
cd scripts
Run the command to send gRPC request (By Default transactional mode)
python bnr.py --target <target_ip:port> --input <input_file_path> --output <output_file_path>
For streaming mode:
python bnr.py --target <target_ip:port> --input <input_file_path> --output <output_file_path> --streaming --sample-rate 48000
When using --streaming
mode, ensure that the selected --sample-rate
(48000, 16000) aligns with the NIM_MODEL_PROFILE
model type configuration to maintain compatibility.
eg: if --sample-rate
is 48000, then NIM_MODEL_PROFILE
with model type v1-48k or v1-16k needs to be selected.
To view details of command line arguments run this command
python bnr.py -h
You will get a response similar to the following.
usage: bnr.py [-h] [--ssl-mode {MTLS,TLS}] [--ssl-key SSL_KEY] [--ssl-cert SSL_CERT] [--ssl-root-cert SSL_ROOT_CERT] [--target TARGET] [--input INPUT] [--output OUTPUT] [--api-key API_KEY] [--function-id FUNCTION_ID] [--streaming] [--sample-rate {48000, 16000}] Process wav audio files using gRPC and apply bnr. options: -h, --help show this help message and exit --preview-mode Flag to send request to preview NVCF server on https://build.nvidia.com/nvidia/bnr/api. --ssl-mode {MTLS,TLS} Flag to set SSL mode, default is None --ssl-key SSL_KEY The path to ssl private key. --ssl-cert SSL_CERT The path to ssl certificate chain. --ssl-root-cert SSL_ROOT_CERT The path to ssl root certificate. --target TARGET IP:port of gRPC service, when hosted locally. Use grpc.nvcf.nvidia.com:443 when hosted on NVCF. --input INPUT The path to the input audio file. --output OUTPUT The path for the output audio file. --api-key API_KEY NGC API key required for authentication, utilized when using TRY API ignored otherwise --function-id FUNCTION_ID NVCF function ID for the service, utilized when using TRY API ignored otherwise --streaming Flag to enable grpc streaming mode. --sample-rate {48000, 16000} Sample rate of input audio file in Hz, default is 48000. --intensity-ratio Intensity ratio value between 0 and 1 to control denoising intensity. Default is 1.0 (maximum denoising).
For more details on getting started with this NIM including configuring using parameters, visit the NVIDIA Maxine BNR NIM Docs.