Running Studio Voice NIM on WSL2#
This section explains how to set up and run Studio Voice NIM on WSL2, whether the client machine is the same as or different from the WSL2 host.
Note
Support for this NIM on WSL is in Public Beta.
Prerequisites#
WSL2 is required for hosting any NIM. Refer to the official NVIDIA NIM on WSL2 documentation for setup instructions.
Note
For WSL, please use podman
instead of docker
in all commands.
Running NIM When the Client and WSL2 Host Are the Same#
If the client and WSL2 host machine are the same, follow these steps:
1. Start the Downloadable NIM on WSL2#
To launch the NIM on WSL2, run this example command.
podman run -it --rm --name=studio-voice \
--device nvidia.com/gpu=all \
--shm-size=8GB \
-e NGC_API_KEY=$NGC_API_KEY \
-e FILE_SIZE_LIMIT=36700160 \
-e STREAMING=false \
-p 8000:8000 \
-p 8001:8001 \
nvcr.io/nim/nvidia/maxine-studio-voice:latest
Note
For information regarding the environment variables of the NIM, refer to Getting Started documentation.
2. Run the Client Inference#
When the NIM is running, follow the steps in Running Inference.
Then run this script to send a gRPC request to the WSL2 NIM on port 8001
:
python studio_voice.py --target localhost:8001 --input <input_file_path> --output <output_file_path>
Running NIM When the Client and WSL2 Host Are Different#
If the client is on a different machine than the WSL2 host, you need to set up port forwarding, because WSL2 uses NAT.
The process involves forwarding traffic from your Windows host’s external IP and port (8001) to the WSL instance’s internal IP and port (8001). All these steps require a Windows terminal with admin privilege.
1. Find the WSL2 Internal IP#
In the WSL2 terminal, execute this command:
hostname -I
2. Forward Traffic from Windows Host to WSL2#
Open Windows terminal with admin privilege and run:
netsh interface portproxy add v4tov4 listenport=8001 listenaddress=0.0.0.0 connectport=8001 connectaddress=<wsl2-ip>
Note
WSL2 IP addresses change after every restart, so you need to update the forwarding rule with the correct IP every restart.
3. Verify Port Forwarding#
netsh interface portproxy show v4tov4
You should see an output similar to this:
Listen on IPv4: Connect to IPv4:
Address Port Address Port
--------------- ---------- --------------- ----------
0.0.0.0 8001 <wsl2-ip> 8001
4. Allow Traffic Through Windows Firewall#
To allow the client from the other machine proper access, add a firewall rule for Port 8001 in Windows Powershell with admin privilege:
New-NetFirewallRule -DisplayName "Allow gRPC on Port 8001" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 8001
5. Run the Downloadable NIM on WSL2#
To launch the NIM on WSL2, run this example command.
podman run -it --rm --name=studio-voice \
--device nvidia.com/gpu=all \
--shm-size=8GB \
-e NGC_API_KEY=$NGC_API_KEY \
-e FILE_SIZE_LIMIT=36700160 \
-e STREAMING=false \
-p 8000:8000 \
-p 8001:8001 \
nvcr.io/nim/nvidia/maxine-studio-voice:latest
Note
For information regarding the environment variables of the NIM, refer to Getting Started documentation.
6. Run the Client Inference#
Follow the steps in Running Inference. Then run this script to send a gRPC request from the client machine to WSL2 NIM:
python studio_voice.py --target <server_ip:port> --input <input_file_path> --output <output_file_path>
Here, server_ip
is the Windows host machine IP, which is running the WSL2 NIM.