Metadata-Version: 2.4
Name: pyfeat-generator
Version: 0.1.1
Summary: Conditional facial-expression editing & face resynthesis runtime (FaceEditor) on top of py-feat 2.0
Author-email: Luke Chang <luke.j.chang@dartmouth.edu>
License: MIT
License-File: LICENSE
License-File: NOTICE
Requires-Python: >=3.10
Requires-Dist: einops
Requires-Dist: huggingface-hub
Requires-Dist: kornia
Requires-Dist: numpy
Requires-Dist: pillow
Requires-Dist: py-feat>=2.0.3
Requires-Dist: scipy
Requires-Dist: timm
Requires-Dist: torch>=2.12
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Description-Content-Type: text/markdown

# pyfeat-generator

Runtime for conditional facial-expression editing and face resynthesis — the
`FaceEditor` / `LiveEditSession` API used by [pyfeat-live](https://github.com/cosanlab/pyfeat-live),
built on [py-feat](https://github.com/cosanlab/py-feat) 2.0. Model weights are
fetched from the `py-feat` HuggingFace org (`py-feat/pyfeat-generator*`).

MIT licensed.

## Install

```bash
pip install pyfeat-generator
```

Pulls `py-feat >= 2.0.3` and `torch >= 2.12`. Model weights download from the
public `py-feat` HuggingFace org on first use (cached thereafter).

## Device support

`FaceEditor` / `LiveEditSession` run on **NVIDIA CUDA, Apple Silicon (MPS), and
CPU**. The rasterizer auto-selects a backend for the device; all three are
parity-gated to byte-identical output, so results never depend on the machine.

| Device | Backend | Notes |
|--------|---------|-------|
| NVIDIA CUDA | `nvdiffrast` | Fastest. **Optional** — `pip install nvdiffrast` separately (needs the CUDA toolkit). Falls back to `torch` if absent. |
| Apple Silicon (MPS) | `metal` | Fused `torch.mps.compile_shader` kernel. **Requires torch ≥ 2.12** (this package's floor); older torch falls back to `torch`. |
| CPU / other | `torch` | Pure-PyTorch, device-agnostic. Always works; slowest. |

`nvdiffrast` is **never imported off CUDA** (the auto-selector guards it behind
`torch.cuda.is_available()`), so it is not a dependency and is not needed on a
Mac. Force a backend with the env var `AU_RASTER_BACKEND=nvdiffrast|metal|torch`.
