renjunok/infinitetalk2
0
1# Repository Guidelines2 3## Project Structure & Module Organization4- `app.py`: Gradio entrypoint orchestrating model initialization, audio preprocessing, and inference flow.5- `src/`: Supporting modules (`audio_analysis/` for wav2vec2 utilities, `vram_management/` for GPU-safe layers, `utils.py` helpers).6- `utils/`: Infrastructure helpers (`model_loader.py` for WAN/InfiniteTalk weights, `gpu_manager.py` for memory checks/cleanup).7- `wan/`: Upstream InfiniteTalk model code; treat as vendor code when updating.8- `assets/` and `examples/`: UI assets and sample media for quick demos; safe to extend.9- `requirements.txt`, `packages.txt`, `Dockerfile`: Deployment dependencies (note: PyTorch + flash-attn installed via Dockerfile/HF build, not from requirements).10 11## Setup, Build, and Local Run12- Create an isolated env: `python -m venv .venv && source .venv/bin/activate`.13- Install Python deps: `pip install -r requirements.txt` (PyTorch/flash-attn come from the base image or HuggingFace Space build).14- Launch UI locally: `python app.py` (Gradio on port 7860 by default).15- Quick sanity check: `python -m py_compile app.py` to catch syntax errors before pushing.16- Docker-based run (mirrors HF build): `docker build -t infinitetalk . && docker run -p 7860:7860 infinitetalk`.17 18## Coding Style & Naming Conventions19- Python 3.10+, PEP 8 with 4-space indentation; favor type hints where practical.20- Functions/variables: `snake_case`; classes: `PascalCase`; constants: `UPPER_SNAKE_CASE`.21- Prefer `logging` over `print` (consistent with existing modules); keep log level INFO for user-facing runs.22- Add concise docstrings for public functions; keep module-level comments minimal and purposeful.23 24## Testing Guidelines25- No automated test suite yet; aim to add `pytest`-style tests under `tests/` mirroring `src/` modules.26- Until then, validate with: (1) `python -m py_compile` for syntax, (2) short inference smoke test using `examples/` media at 480p/30–40 steps.27- When adding tests, name files `test_<module>.py` and target functional paths (audio preprocessing, GPU guardrails, model loader paths).28 29## Commit & Pull Request Guidelines30- Repository has no historical git log; use Conventional Commits (`feat:`, `fix:`, `docs:`, `chore:`) for clarity.31- One topic per commit; keep messages imperative and ≤72 chars in the subject.32- 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.33- Avoid committing large model weights or cached downloads; rely on `ModelManager` to fetch at runtime and .gitignore caches.34 35## Security & Configuration Tips36- For private models, set `HF_TOKEN` in the environment/Space secrets; do not hardcode secrets.37- Respect GPU limits in `gpu_manager.py` when adjusting defaults; keep ZeroGPU duration estimates in mind.38- Large files: keep under repo size limits; store extra assets in external storage or release artifacts.39 