🧬 Welmia Face 1.0 β€” 3.6M Base

A featherweight 3.6-million-parameter GAN that synthesizes 128Γ—128 human faces from pure noise β€” fast enough to run in real time on a laptop CPU.

πŸ†• Newer model available: Welmia Face 2.0 β€” 7.6M Base β€” a StyleGAN2-style GAN with cleaner, more detailed faces. It is roughly 2Γ— slower per image than this model, so Face 1.0 is still the pick if raw CPU speed matters most.

Sample grid


✨ Highlights

  • Tiny footprint β€” only 3,608,006 parameters (~14 MB on disk). Smaller than most profile pictures.
  • Blazing fast on CPU β€” generates 50 faces in under 1 second on an Intel Core i5-10400 with integrated graphics and 16 GB RAM. No GPU required.
  • Safe by design β€” weights shipped in safetensors format. No pickle, no arbitrary-code-execution risk.
  • Zero dependencies beyond PyTorch β€” one script, one checkpoint, instant faces.
  • Fully reproducible β€” seeded sampling means you can regenerate the exact same faces shown here.

⚑ Speed Benchmark

Tested on consumer hardware β€” no datacenter silicon, no CUDA:

Hardware Images Time Throughput
Intel Core i5-10400 (iGPU, 16 GB RAM) 50 < 1 second ~50+ img/s
Same machine 8 ~150 ms interactive

This model is built to run everywhere β€” old laptops, Raspberry Pi-class devices, CI pipelines, browser backends. If it has Python and ~16 GB of addressable memory, it can generate faces in real time.


πŸš€ Quick Start

1. Install dependencies

pip install torch torchvision safetensors

2. Generate faces

python generate.py

Outputs land in ./inference_output/ β€” four individual PNGs plus a preview grid.

3. Programmatic usage

import torch
from safetensors.torch import load_file
from torchvision import utils as vutils

class Generator(torch.nn.Module):
    def __init__(self, nz=100, ngf=64):
        super().__init__()
        self.net = torch.nn.Sequential(
            torch.nn.ConvTranspose2d(nz, ngf * 8, 4, 1, 0, bias=False),
            torch.nn.BatchNorm2d(ngf * 8), torch.nn.ReLU(True),
            torch.nn.ConvTranspose2d(ngf * 8, ngf * 4, 4, 2, 1, bias=False),
            torch.nn.BatchNorm2d(ngf * 4), torch.nn.ReLU(True),
            torch.nn.ConvTranspose2d(ngf * 4, ngf * 2, 4, 2, 1, bias=False),
            torch.nn.BatchNorm2d(ngf * 2), torch.nn.ReLU(True),
            torch.nn.ConvTranspose2d(ngf * 2, ngf, 4, 2, 1, bias=False),
            torch.nn.BatchNorm2d(ngf), torch.nn.ReLU(True),
            torch.nn.ConvTranspose2d(ngf, ngf // 2, 4, 2, 1, bias=False),
            torch.nn.BatchNorm2d(ngf // 2), torch.nn.ReLU(True),
            torch.nn.ConvTranspose2d(ngf // 2, 3, 4, 2, 1, bias=False),
            torch.nn.Tanh(),
        )
    def forward(self, z): return self.net(z)

netG = Generator().eval()
netG.load_state_dict(load_file("model.safetensors"))

with torch.no_grad():
    z = torch.randn(1, 100, 1, 1)
    img = netG(z)

vutils.save_image(img, "face.png", normalize=True)

πŸŽ›οΈ Configuration

Edit the constants at the top of generate.py:

Knob Default Effect
NUM_IMAGES 4 How many faces per run
SEED 42 Fixed seed for reproducibility; set to None for random faces
TRUNCATION 1.0 1.0 = full diversity Β· ~0.7 = sharper but less varied
DEVICE auto Auto-detects CUDA; falls back to CPU
OUTPUT_DIR inference_output Where PNGs are saved

πŸ“ Model Architecture

Property Value
Type DCGAN-style Generator
Parameters 3,608,006
Tensors 31
Latent dimension 100
Output resolution 128 Γ— 128 Γ— 3
Activation Tanh (output range [-1, 1])
File size ~14 MB (float32, safetensors)
Training data ~40k low-quality face images
Training stage Pre-train (base checkpoint)

The network is a six-layer transposed-convolution stack with batch normalization and ReLU activations β€” the canonical DCGAN generator topology, scaled down to fit comfortably in L1/L2 cache on modern CPUs.


πŸ—ΊοΈ Roadmap

  • v1.0 base β€” pre-trained on 40k images (you are here)
  • v1.1 fine-tune β€” high-quality curated dataset for sharper detail
  • v1.2 256px β€” resolution bump with progressive training
  • Gradio demo β€” live browser playground via HF Spaces

⚠️ Limitations & Responsible Use

  • Resolution is 128px β€” expect soft edges and occasional asymmetry. This is a tiny model doing impressive work, not a production face renderer.
  • Pre-train only β€” fine-tuning on high-quality data is planned and will noticeably improve fidelity.
  • Training data was low quality β€” do not use outputs for identity-sensitive applications, biometrics, or anything requiring photorealism.
  • Synthetic faces only β€” every output is a novel person that never existed. Do not present generated faces as real individuals.

πŸ“œ License

Released under CC-BY-NC-4.0 β€” free to use, share, and adapt for non-commercial purposes with attribution. See LICENSE for full terms.

If your intended use is commercial, please reach out.


πŸ™ Acknowledgements

Built with PyTorch and the safetensors library. Architecture follows the DCGAN design by Radford et al. (2015). Hosted on Hugging Face.


πŸ”— Links


Made with curiosity, a small GPU budget, and too much coffee. β˜•

Downloads last month
62
Safetensors
Model size
3.61M params
Tensor type
F32
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Evaluation results

  • inference_speed on ~40k low-quality face images
    self-reported
    <1s for 50 images