Development#
Project Structure#
audio2face/
โโโ apis/ # Streaming API implementations
โโโ data_structures/ # Core data models and Protocol Buffers
โโโ infer/ # Inference engines (ONNX and PyTorch)
โโโ postprocess/ # Postprocessing modules and pipelines
โโโ service/ # FastAPI server and error handling
โโโ split/ # Audio splitting and segmentation
โโโ utils/ # Utility functions and base classes
โโโ tests/ # Comprehensive test suite
Testing#
The project includes comprehensive tests with pytest and async testing support. Before running tests, you need to prepare the test input data.
Test Data Preparation#
Download the required test files and organize them in the correct directory structure:
Create test input directory:
mkdir -p input
Download test files:
Test Audio: test_audio.wav - Download and save to
input/test_audio.wavTest Feature: test_feature.npy - Download and save to
input/test_feature.npy
Ensure weights directory exists:
mkdir -p weights
Make sure you have the ONNX model file
weights/unitalker_v0.4.0_base.onnx(see Data Preparation section).Final directory structure should be:
โโaudio2face โโconfigs โโdocs โโinput โ โโtest_audio.wav โ โโtest_feature.npy โโweights โโunitalker_v0.4.0_base.onnx
Running Tests#
# Run all tests
pytest tests --log-cli-level=ERROR
# Run specific test categories
pytest tests/apis/ # API functionality tests
pytest tests/infer/ # Inference engine tests
pytest tests/postprocess/ # Postprocessing module tests
pytest tests/data_structures/ # Data structure tests
Test Coverage#
API Tests: Streaming API functionality
Inference Tests: ONNX Unitalker and PyTorch feature extractor validation
Postprocessing Tests: All postprocessing modules with various configurations
Data Structure Tests: FaceClip class functionality and format conversions
Code Quality#
The project maintains high code quality with:
Linting: Ruff for code style and quality checks
Type Hints: Full type annotation support
CI/CD: Automated testing and deployment pipelines