You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,12 +2,14 @@
2
2
3
3
## 1.0.0
4
4
5
-
Released on April 18, 2026.
5
+
Released on May 1, 2026.
6
6
7
7
### Breaking Changes
8
8
* Minimum Python version raised from 3.8 to 3.10
9
+
* Supported Python range is now explicitly capped at `<3.14`, matching the tested v1 CI matrix
9
10
* Minimum PyTorch version raised from 1.9 to 2.3
10
11
* All models migrated from TorchScript (.pt) to torch.export (.pt2) format
12
+
* Default model loading now relies on Hugging Face `.pt2` artifacts; Google Drive/TorchScript artifacts are retained only as legacy fallbacks where available
11
13
*`path_image` and `tensor` parameters in `FaceAnalyzer.run()` are deprecated in favor of `image_source`
12
14
13
15
### Added
@@ -21,13 +23,15 @@ Released on April 18, 2026.
21
23
* Torch-versioned exported model cohorts and runtime fallback routing for `.pt2` artifacts (for example `model-torch2.3.pt2`, `model-torch2.6.pt2`, `model-torch2.11.pt2`)
*`uv.lock` for reproducible PyPI-based dependency resolution
26
29
*`[tool.uv]` configuration in `pyproject.toml`
27
30
28
31
### Changed
29
32
* Migrated from `setup.py` + `version` file to `pyproject.toml` (PEP 621)
30
33
* All model files migrated from TorchScript (.pt) to torch.export (.pt2) portable format with dynamic batch support
34
+
* Model artifact strategy changed to prioritize portability and install-time simplicity over TorchScript-specific runtime behavior: `.pt2` artifacts do not require bundled model source code, while versioned cohorts handle PyTorch exported-program schema differences across supported torch runtimes (`2.3`, `2.6`, `2.11`)
31
35
* AU predictor model rewritten with timm Swin Transformer backbone for torch.export compatibility
32
36
* Docker dev/test images migrated from conda/conda-lock to [uv](https://github.com/astral-sh/uv) for faster builds
33
37
* Docker production images now use uv as a pip drop-in
@@ -45,6 +49,8 @@ Released on April 18, 2026.
45
49
* Numpy array reader now handles (H, W) and (H, W, 1) grayscale arrays
46
50
* AU `.pt2` CUDA device mismatch by re-exporting validated AU cohorts (`2.3`, `2.6`, `2.11`) and publishing refreshed Hugging Face artifacts with metadata
47
51
* Exported-model schema mismatch fallback now also handles additional cross-version `.pt2` archive load errors (for example missing `version` entry)
52
+
* Export cohort validation now fails on numerical drift beyond configured max/mean absolute-difference tolerances instead of only recording comparison metrics
53
+
* Test configs now resolve `/opt/facetorch` paths to the checked-out repository during local pytest runs, while preserving Docker CI behavior
Copy file name to clipboardExpand all lines: README.md
+36-8Lines changed: 36 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ Facetorch provides an efficient, scalable, and user-friendly solution for facial
33
33
34
34
### Requirements
35
35
36
-
* Python >= 3.10
36
+
* Python >= 3.10 and < 3.14
37
37
* PyTorch >= 2.3 (facetorch routes exported model artifacts by torch minor version)
38
38
39
39
Please use this library responsibly and with caution. Adhere to the [European Commission's Ethics Guidelines for Trustworthy AI](https://ec.europa.eu/futurium/en/ai-alliance-consultation.1.html) to ensure ethical and fair usage. Keep in mind that the models may have limitations and potential biases, so it is crucial to evaluate their outputs critically and consider their impact.
@@ -229,22 +229,47 @@ Models are available on the [Hugging Face Hub](https://huggingface.co/tomas-gaja
229
229
For exported `.pt2` models, facetorch can fall back across versioned artifacts when present (e.g. `model-torch2.3.pt2`, `model-torch2.6.pt2`, `model-torch2.11.pt2`).
230
230
By default, the downloader tries `model.pt2` first, then versioned cohort artifacts, and finally `model.pt` as a legacy fallback where available.
231
231
232
+
#### Why exported models?
233
+
234
+
Facetorch v1 moved default model artifacts from TorchScript (`.pt`) to `torch.export` (`.pt2`) so inference no longer depends on bundled model source code, custom class definitions, or TorchScript-specific runtime behavior. This makes the hosted models easier to validate, redistribute, and load across normal Python package installations. TorchScript artifacts are still useful as legacy fallbacks, but v1 workflows should prefer Hugging Face `.pt2` artifacts.
235
+
236
+
`torch.export` serialization is tied to PyTorch's exported-program schema, so one `.pt2` file is not guaranteed to load across every future or older PyTorch minor version. To avoid pinning users to one narrow torch version, facetorch publishes and validates cohort artifacts for representative supported runtimes: `torch 2.3`, `torch 2.6`, and `torch 2.11`. Runtime support starts at `PyTorch >= 2.3`; when versioned cohorts are available, the downloader selects from those artifacts and falls back to the next candidate if the current runtime cannot load the first choice.
237
+
232
238
233
239
### Execution time
234
240
235
-
Reference GPU benchmark (warm second pass, batch_size=8, utilizers disabled):
-Timings are reported from the second inference pass to avoid first-pass warm-up effects.
266
+
-Reference GPU timings include pass-level values; artifact comparisons use warm medians to avoid first-pass warm-up effects.
246
267
- Timings above include all predictors, including AU.
247
268
- Utilizers were disabled for this benchmark run.
269
+
- Full TorchScript CUDA comparison required disabling TorchScript profiling/fuser paths for runtime stability (`_jit_set_profiling_executor(False)`, `_jit_set_profiling_mode(False)`, `_jit_override_can_fuse_on_gpu(False)`).
270
+
- In this setup, TorchScript is only slightly faster in warm median (about 2-4 ms, <2%); treat this as near-parity rather than a large format-level difference.
271
+
- On CPU, TorchScript was faster by about 8-9% for this full-stack run.
272
+
- TorchScript shows much slower first pass on some runs (runtime graph specialization), so use warm metrics for fair comparison.
248
273
- One can monitor component timings in logs using DEBUG level.
249
274
250
275
@@ -279,7 +304,7 @@ For broader PyTorch compatibility, publish recommended version cohorts in the sa
279
304
-`model-torch2.11.pt2`
280
305
- (optional compatibility fallback) `model.pt2`
281
306
282
-
To export, validate, and upload all facetorch model cohorts for the current torch runtime, use:
307
+
From a source checkout, export, validate, and upload all facetorch model cohorts for the current torch runtime with:
Use `--model-ids` (for example `--model-ids verify-magface`) to process only a subset.
332
+
The script writes a `.meta.json` file next to each artifact and fails the run if validated outputs exceed the configured numerical tolerances.
333
+
Export-only architecture definitions live in `model_defs/`; they are included for reproducible re-exporting, but they are not required for normal `.pt2` inference.
307
334
308
335
#### Configuration
309
336
##### Create yaml file
@@ -342,6 +369,7 @@ the requirements of the new model.
342
369
*`pyproject.toml` is the packaging source of truth for PyPI releases and pip/uv installs (including Docker build paths using uv).
343
370
* Conda package publishing (`conda-forge/facetorch`) is maintained outside this repository in conda-forge feedstock workflows.
344
371
*`environment.yml` and `gpu.environment.yml` are conda environment baselines for conda users.
372
+
* The GPU conda baseline uses conda-forge `cuda-version=12.4` instead of `cudatoolkit`; pass `--with-cuda` when regenerating the GPU lock so conda-lock can resolve CUDA virtual packages without requiring a local GPU.
345
373
* Overlapping dependencies between pyproject and conda env files are intentionally kept aligned.
346
374
* CI enforces this with: `python scripts/check_dependency_sync.py`.
347
375
@@ -353,13 +381,13 @@ the requirements of the new model.
353
381
#### conda (for conda-forge users)
354
382
CPU:
355
383
* Add packages with corresponding versions to ```environment.yml``` file
0 commit comments