handwritten-digits-generator

Writes numbers in handwriting. Ask for "2026" and it draws each digit in a fresh handwriting style:

2026

A conditional variational autoencoder (digit_writer.py, about 0.3M parameters) trained for 50 epochs on wiz-io/handwritten-digits, a 10k-image subset of MNIST. Final training loss: 95.7 (reconstruction 74.6 + KL 21.1, per image).

Each row below is one digit, written ten times with different random styles:

samples

Usage

import sys
from huggingface_hub import hf_hub_download

sys.path.insert(0, hf_hub_download("wiz-io/handwritten-digits-generator", "digit_writer.py").rsplit("/", 1)[0])
from digit_writer import DigitWriter

model = DigitWriter.from_pretrained("wiz-io/handwritten-digits-generator")
model.write_number("2026", temperature=0.8).save("number.png")

Lower temperature gives neater, more average digits; higher gives more varied, messier ones.

Training

train.py runs as a Hugging Face Job on CPU. It keeps its working files (a snapshot of the MNIST source, per-epoch checkpoints for resuming, metrics and sample grids) in the private bucket wiz-io/handwritten-digits-training.

Downloads last month
29
Safetensors
Model size
271k params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Dataset used to train wiz-io/handwritten-digits-generator