Skip to content

Commit 11d89d2

Browse files
committed
Merge tutorials, add tritony-sample
1 parent 2a04e0e commit 11d89d2

25 files changed

Lines changed: 570 additions & 18 deletions

.pre-commit-config.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.5.0
3+
rev: v4.6.0
44
hooks:
55
- id: check-json
66
- id: end-of-file-fixer
@@ -11,7 +11,7 @@ repos:
1111
- id: check-added-large-files
1212
args: [--maxkb=4096]
1313
- repo: https://github.com/psf/black
14-
rev: 24.2.0
14+
rev: 24.3.0
1515
hooks:
1616
- id: black
1717
args: [--line-length=120]
@@ -27,3 +27,9 @@ repos:
2727
- id: flake8
2828
types: [python]
2929
args: ["--max-line-length", "88", "--ignore", "E203,E501,W503,W504"]
30+
- repo: https://github.com/shellcheck-py/shellcheck-py
31+
rev: v0.10.0.1
32+
hooks:
33+
- id: shellcheck
34+
exclude: test
35+
args: ["--exclude", "SC1091,SC1073,SC2086,SC2128"]

README.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
1-
# RTZR Streaming STT API(gRPC) with Mic. Interface
1+
# Python Audio Processing Tutorials
22

3-
## Requirements
4-
This repository need `PyAudio` library. First, you need to read installation instruction `PyAudio` [this link](https://pypi.org/project/PyAudio/).
3+
Welcome to the Python Audio Processing Tutorials repository. This repository contains two main projects focusing on real-time audio processing using different technologies and frameworks.
54

6-
And Then,
5+
## Projects
6+
7+
### 1. RTZR Streaming STT API(gRPC) with Mic. Interface
8+
9+
This project demonstrates how to set up a real-time streaming Speech-to-Text (STT) API using gRPC with microphone interface capabilities. It requires the installation of the `PyAudio` library and additional setup for gRPC communication.
10+
11+
- **Requirements**: PyAudio (see [installation instructions](https://pypi.org/project/PyAudio/)).
12+
- **Setup**: Download necessary `.proto` files and generate gRPC client code. For details, check the project's [README](./python-stt-sample/).
13+
14+
### 2. Triton, Tritony VAD Client Sample
15+
16+
This project showcases the use of the Triton Inference Server and Tritony Voice Activity Detection (VAD) to process and analyze audio streams effectively. It involves setting up a Docker container and running a Triton server.
17+
18+
- **Requirements**: pydub, tritonclient, tritony
19+
- **Setup**: Build and run a Docker image for the Triton Inference Server. Testing is facilitated through predefined scripts and pytest. For more information, visit the project's [README](./tritony-sample/).
20+
21+
## General Installation
22+
23+
Most project dependencies can be installed via pip:
724

825
```bash
926
pip install -r requirements.txt
10-
```
11-
Download `.proto` file from this [Link](https://github.com/vito-ai/openapi-grpc/blob/main/protos/vito-stt-client.proto). And save `.proto` file in the project directory.
12-
13-
And run this command to generate grpc file.
14-
```bash
15-
python -m grpc_tools.protoc -I. --python_out=./src --grpc_python_out=./src ./vito-stt-client.proto
16-
```
17-

python-stt-sample/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# RTZR Streaming STT API(gRPC) with Mic. Interface
2+
3+
## Requirements
4+
This repository need `PyAudio` library. First, you need to read installation instruction `PyAudio` [this link](https://pypi.org/project/PyAudio/).
5+
6+
And Then,
7+
8+
```bash
9+
pip install -r requirements.txt
10+
```
11+
Download `.proto` file from this [Link](https://github.com/vito-ai/openapi-grpc/blob/main/protos/vito-stt-client.proto). And save `.proto` file in the project directory.
12+
13+
And run this command to generate grpc file.
14+
```bash
15+
python -m grpc_tools.protoc -I. --python_out=./src --grpc_python_out=./src ./vito-stt-client.proto
16+
```
17+
File renamed without changes.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@
2828

2929
import grpc
3030
import soundfile as sf
31-
from requests import Session
32-
3331
import vito_stt_client_pb2 as pb
3432
import vito_stt_client_pb2_grpc as pb_grpc
33+
from requests import Session
3534

3635
API_BASE = "https://openapi.vito.ai"
3736
GRPC_SERVER_URL = "grpc-openapi.vito.ai:443"
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77

88
import grpc
99
import pyaudio
10-
from requests import Session
11-
1210
import vito_stt_client_pb2 as pb
1311
import vito_stt_client_pb2_grpc as pb_grpc
12+
from requests import Session
1413

1514
API_BASE = "https://openapi.vito.ai"
1615
GRPC_SERVER_URL = "grpc-openapi.vito.ai:443"

tritony-sample/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM nvcr.io/nvidia/tritonserver:23.08-py3
2+
3+
RUN apt update && apt install -y --no-install-recommends \
4+
libsndfile1 \
5+
&& apt clean \
6+
&& rm -rf /var/lib/apt/lists/*;
7+
8+
RUN pip install --upgrade pip && \
9+
pip install torch torchaudio==2.1.2 && \
10+
pip install pyannote.audio

tritony-sample/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Triton, Tritony VAD Client sample
2+
3+
## Requirements
4+
This repository requires `pydub`, `tritonclient`, `tritony` python libraries. So you need to run following command.
5+
6+
```bash
7+
pip install -r requirements.txt
8+
```
9+
10+
Next, you can build Docker image using shell script.
11+
12+
```bash
13+
/bin/bash ./build_triton_server.sh
14+
```
15+
or
16+
17+
For manually building Docker image, you must assign your docker image tag `triton-vad-server:latest`.
18+
19+
## Run Triton Inference Server
20+
To start Triton Inference Server, run the below command.
21+
You will need to set the `HF_TOKEN` environment variable to your Hugging Face API token. ( https://huggingface.co/docs/hub/security-tokens )
22+
23+
```bash
24+
export HF_TOKEN=YOUR_HF_TOKEN
25+
/bin/bash ./bin/run_triton_server.sh
26+
```
27+
## Test
28+
First, you must run Triton Inference Server.
29+
```bash
30+
pytest -s
31+
```
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
HERE=$(dirname "$(readlink -f $0)")
4+
PARENT_DIR=$(dirname "$HERE")
5+
6+
docker run -it --rm --name triton_tritony \
7+
-p8100:8000 \
8+
-p8101:8001 \
9+
-p8102:8002 \
10+
-v "${PARENT_DIR}"/model_repository:/model_repository:ro \
11+
-e OMP_NUM_THREADS=4 \
12+
-e OPENBLAS_NUM_THREADS=4 \
13+
-e HF_TOKEN=$HF_TOKEN \
14+
--shm-size=4g \
15+
triton-vad-server:latest \
16+
tritonserver --model-repository=/model_repository \
17+
--exit-timeout-secs 15 \
18+
--min-supported-compute-capability 7.0 \

0 commit comments

Comments
 (0)