Running Inference

Verify Server Health

Perform a health check on the gRPC endpoint.

  1. Install grpcurl from here

    Example commands to run on Ubuntu:

    wget https://github.com/fullstorydev/grpcurl/releases/download/v1.9.1/grpcurl_1.9.1_linux_amd64.deb
    sudo dpkg -i grpcurl_1.9.1_linux_amd64.deb
    
  2. Download the health checking proto:

    wget https://raw.githubusercontent.com/grpc/grpc/master/src/proto/grpc/health/v1/health.proto
    
  3. Run the health check on <server_ip> or localhost:

    grpcurl --plaintext --proto health.proto <server_ip>:8001 grpc.health.v1.Health/Check
    

If the service is ready, you will get a response similar to the following:

{ "status": "SERVING" }

Running Inference via Script

1. Clone the Repository

Download the Maxine Studio Voice Python client code by cloning the NVIDIA Maxine NIM Clients Repository:

git clone https://github.com/NVIDIA-Maxine/nim-clients.git

# Go to the 'studio-voice' folder

cd nim-clients/studio-voice/

2. Install Dependencies

sudo apt-get install python3-pip
pip install -r requirements.txt

3. Run the Python Client

You can use the sample client script in the Maxine Studio Voice GitHub repo to send a gRPC request to the hosted NIM server:

  1. Go to the scripts directory.

    cd scripts
    
  2. Run the command to send gRPC request.

    python studio_voice.py --target <server_ip:port> --input <input_audio_file_path> --output <output_audio_file_path>
    

The following example command processes the packaged sample audio file and generates a studio_voice_48k_output.wav file in the current folder.

python studio_voice.py --target 127.0.0.1:8001 --input ../assets/studio_voice_48k_input.wav --output studio_voice_48k_output.wav

Note

Only WAV files are supported.

Usage for Preview API Request

python studio_voice.py --use-ssl \
    --target grpc.nvcf.nvidia.com:443 \
    --function-id <function_id> \
    --api-key $API_KEY_REQUIRED_IF_EXECUTING_OUTSIDE_NGC \
    --input <input_file_path> \
    --output <output_file_path>

Command Line Arguments

To view the details of command line arguments, run this command:

python studio_voice.py -h
  • --use-ssl - Flag to control if SSL/TLS encryption should be used. When running preview SSL must be used.

  • --target <ip:port> - URI of NIM’s gRPC service. Use grpc.nvcf.nvidia.com:443 when hosted on NVCF. Default value is 127.0.0.1:8001.

  • --api-key <NGC_API_KEY> - NGC API key required for authentication. Utilized when using TRY API, ignored otherwise.

  • --function-id - NVCF function ID for the service. Utilized when using TRY API, ignored otherwise.

  • --input - The path to the input audio file. Default value is ../assets/studio_voice_48k_input.wav.

  • --output - The path for the output audio file. Default is ./studio_voice_48k_output.wav.