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.

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

.
β”œβ”€β”€ 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

python run.py

2. ONNX Runtime Demo

python run_onnx.py

Once running, access http://localhost:8000/ in a web browser or run:

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:
    python scrape.py
    
  2. Train Model:
    python train.py
    
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support