Spaces:
Running
Running
A newer version of the Gradio SDK is available:
6.1.0
Repository Guidelines
Project Structure & Module Organization
app.py: Gradio entrypoint orchestrating model initialization, audio preprocessing, and inference flow.src/: Supporting modules (audio_analysis/for wav2vec2 utilities,vram_management/for GPU-safe layers,utils.pyhelpers).utils/: Infrastructure helpers (model_loader.pyfor WAN/InfiniteTalk weights,gpu_manager.pyfor memory checks/cleanup).wan/: Upstream InfiniteTalk model code; treat as vendor code when updating.assets/andexamples/: UI assets and sample media for quick demos; safe to extend.requirements.txt,packages.txt,Dockerfile: Deployment dependencies (note: PyTorch + flash-attn installed via Dockerfile/HF build, not from requirements).
Setup, Build, and Local Run
- Create an isolated env:
python -m venv .venv && source .venv/bin/activate. - Install Python deps:
pip install -r requirements.txt(PyTorch/flash-attn come from the base image or HuggingFace Space build). - Launch UI locally:
python app.py(Gradio on port 7860 by default). - Quick sanity check:
python -m py_compile app.pyto catch syntax errors before pushing. - Docker-based run (mirrors HF build):
docker build -t infinitetalk . && docker run -p 7860:7860 infinitetalk.
Coding Style & Naming Conventions
- Python 3.10+, PEP 8 with 4-space indentation; favor type hints where practical.
- Functions/variables:
snake_case; classes:PascalCase; constants:UPPER_SNAKE_CASE. - Prefer
loggingoverprint(consistent with existing modules); keep log level INFO for user-facing runs. - Add concise docstrings for public functions; keep module-level comments minimal and purposeful.
Testing Guidelines
- No automated test suite yet; aim to add
pytest-style tests undertests/mirroringsrc/modules. - Until then, validate with: (1)
python -m py_compilefor syntax, (2) short inference smoke test usingexamples/media at 480p/30–40 steps. - When adding tests, name files
test_<module>.pyand target functional paths (audio preprocessing, GPU guardrails, model loader paths).
Commit & Pull Request Guidelines
- Repository has no historical git log; use Conventional Commits (
feat:,fix:,docs:,chore:) for clarity. - One topic per commit; keep messages imperative and ≤72 chars in the subject.
- PRs should include: brief summary of behavior change, commands run (tests or smoke steps), any new dependencies, and before/after screenshots or sample outputs if UI/inference is affected.
- Avoid committing large model weights or cached downloads; rely on
ModelManagerto fetch at runtime and .gitignore caches.
Security & Configuration Tips
- For private models, set
HF_TOKENin the environment/Space secrets; do not hardcode secrets. - Respect GPU limits in
gpu_manager.pywhen adjusting defaults; keep ZeroGPU duration estimates in mind. - Large files: keep under repo size limits; store extra assets in external storage or release artifacts.