🧬 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.

✨ 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
safetensorsformat. 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
- 👤 Author: Muhammed Rishdin T (@Welmia)
- 🌐 Website: welmia.kesug.com
- 🤗 HF Profile: huggingface.co/Welmia
- 🧬 Newer model: welmia-face-2.0-7.6m-base
- 🐛 Issues / Feedback: open a discussion on this repo