|
Download README.md from YesWhyNot/alosha-painter: direct link, hf CLI and curl.
- Browser
- Download file 2.42 kB
-
https://huggingface.co/YesWhyNot/alosha-painter/resolve/main/README.md
- Command line
-
hf download hf://YesWhyNot/alosha-painter/README.md
-
curl -L -o README.md https://huggingface.co/YesWhyNot/alosha-painter/resolve/main/README.md
2.42 kB
| license: mit | |
| tags: | |
| - pytorch | |
| - onnx | |
| - flow-matching | |
| - generative-art | |
| - face-generation | |
| pipeline_tag: image-to-image | |
| # Alosha Painter | |
| **Alosha Painter** is a generative computer vision model designed to draw and generate human faces using a custom **Flow Matching UNet** (`FlowMatchingUNet`). The model was trained on synthetic facial datasets collected by scraping [ThisPersonDoesNotExist.com](https://thispersondoesnotexist.com). | |
| This repository contains the full model definition, training scripts, PyTorch EMA checkpoints, optimized ONNX exports (FP32, FP16, and INT8), and a local FastAPI demo server for quick image generation testing. | |
| --- | |
| ## Repository Structure | |
| ```text | |
| . | |
| βββ run.py # FastAPI demo server (PyTorch runtime) | |
| βββ run_onnx.py # FastAPI demo server (ONNX Runtime) | |
| βββ scrape.py # Data collection script for ThisPersonDoesNotExist | |
| βββ train.py # FlowMatchingUNet architecture & training pipeline | |
| βββ data/ | |
| β βββ faces/ # Scraped training dataset | |
| βββ weights/ | |
| βββ checkpoint_latest.pth # PyTorch EMA model checkpoint | |
| βββ unface.onnx # Standard FP32 ONNX export | |
| βββ unface_fp16.onnx # FP16 precision ONNX model (GPU) | |
| βββ unface_int8.onnx # Quantized INT8 ONNX model (CPU) | |
| ``` | |
| --- | |
| ## Running the Demo Server | |
| A lightweight FastAPI server is provided in `run.py` and `run_onnx.py` as a demo to test generation outputs via HTTP GET requests. | |
| ### 1. PyTorch Runtime Demo | |
| ```bash | |
| python run.py | |
| ``` | |
| ### 2. ONNX Runtime Demo | |
| ```bash | |
| python run_onnx.py | |
| ``` | |
| Once running, access `http://localhost:8000/` in a web browser or run: | |
| ```bash | |
| curl http://localhost:8000/ --output generated_face.png | |
| ``` | |
| Each request runs the flow-matching ODE sampler (`steps=20`), applies 2x bicubic upsampling, and returns a PNG image. | |
| --- | |
| ## Technical Details | |
| * **Architecture:** Custom Flow Matching UNet (`FlowMatchingUNet`) | |
| * **Sampling:** ODE vector-field integration | |
| * **Checkpointing:** Exponential Moving Average (EMA) weights (`ckpt["ema"]`) | |
| * **ONNX Exports:** Pre-compiled FP32, FP16, and INT8 quantized binaries for fast CPU/GPU deployment without PyTorch overhead. | |
| --- | |
| ## Dataset & Training | |
| 1. **Scrape Training Dataset:** | |
| ```bash | |
| python scrape.py | |
| ``` | |
| 2. **Train Model:** | |
| ```bash | |
| python train.py | |
| ``` |