--- license: apache-2.0 library_name: pytorch pipeline_tag: text-to-image tags: - text-to-image - from-scratch - rectified-flow - tiny-model - 64x64 datasets: - common-canvas/commoncatalog-cc-by vertex_family: sunstone vertex_name: "Sunstone Image Preview" vertex_base: "None (trained from scratch)" vertex_params: "49.1M" vertex_purpose: "A small text-to-image model that makes 64x64 pictures, trained from scratch on a single gaming GPU" vertex_result: "Good at skies, sunsets, landscapes, flowers, cars and buildings; weak at animals, faces and fine detail. 850,000 steps in 4.3 days on a GTX 1660 Ti; validation loss 0.0790" vertex_status: released --- # Sunstone Image Preview A **49.1M-parameter text-to-image model that makes 64×64 pictures**, trained completely from scratch (no pretrained VAE, CLIP, T5 or Stable Diffusion weights anywhere) on a single GTX 1660 Ti (6 GB) in about 4.3 days. It is a *preview*: a small experiment that works, not a production image generator. Type a short description, get a small picture. ![32 prompts, final model](samples/grid_step_850000_32_training_prompts.png) *Final model, 32 fixed prompts (one image each, seed 1234, enlarged from 64×64).* ## Available formats Everything below lives in this one repository: pick the format that matches your runtime. _No weight files were found in this repository yet._ ## What it is good and bad at I looked at 64 images from 16 new prompts (4 seeds each) after training. Honestly: | Works well | Works poorly | |---|---| | Sunsets and skies (the best by far) | Animals: cats, dogs and horses come out as blurry shapes with the right colours and setting | | Landscapes: forests, mountains, lakes, fields | Faces and hands (blobs) | | Flowers, red cars, buildings, churches with steeples | Specific objects: "a bowl of fruit" gave plates of cooked food, "a cup of coffee" gave swirly bowls | | Colour, lighting and overall mood | Anything small, detailed or counted; any text in the image | Prompts are followed loosely, not precisely (for example "a white house with a red roof" always had a red roof, but not always a white house). More samples: [sheet 1](samples/prompts_sheet_1.png), [sheet 2](samples/prompts_sheet_2.png), [sunsets, mountains and steeples](samples/sunset_mountain_steeple.png). I have no image-quality score (no FID); judge it by the samples. Final validation loss is 0.0790 (EMA 0.0789). ## Use it ```bash pip install torch numpy pillow tokenizers python generate.py "a sunset over the beach" --n 4 --out sunset.png ``` `generate.py` picks CUDA, Apple MPS or CPU on its own (four images take about 14 seconds on an Apple Silicon Mac). Prompts are lower-cased and cut to 24 tokens. Options: `--seed`, `--cfg` (guidance, default 3.0), `--steps` (default 40), `--scale` (enlarge the output, default 4). Prompts that look like photo captions work best ("a mountain lake at sunrise", "a red car parked on a street"), because the training captions were written that way. ## How it was made | | | |---|---| | Architecture | 4-layer text transformer (384-d, trained jointly) + a 64×64 pixel-space U-Net (channels 64, multipliers 1/2/3/4, 2 residual blocks per level) with self- and cross-attention at 16×16 and 8×8 | | Parameters | 49.1M in total | | Objective | Rectified flow (velocity prediction), logit-normal time sampling, 10% caption dropout for classifier-free guidance | | Training | 850,000 steps, batch 32 (about 28M images seen), AdamW, learning rate 2e-4 with warm-up and cosine decay, EMA weights (the released file) | | Hardware | One GTX 1660 Ti, fp32 (fp16 was slower on this card), about 4.3 days | | Tokenizer | The project's own 32K byte-level BPE (`tokenizer/`) | | Sampling | 40 Euler steps, guidance 3.0 | ### Training data and attribution 565,463 photos from [CommonCatalog CC-BY](https://huggingface.co/datasets/common-canvas/commoncatalog-cc-by): Flickr photographs released under **CC-BY 4.0**, each with a machine-written (BLIP-2) caption. Photos were centre-cropped to near-square and shrunk to 64×64. The photographs belong to their many individual creators, who are credited through that dataset; please see it for the full attribution. **The photos include people**, and the model can produce people-like shapes (it is not good at them). Because the captions are machine-written, the model learned the habits and mistakes of that captioner too. ## Limits and intended use - 64×64 only. Enlarging gives a soft, blurry picture. - A hobby-scale research preview: there is no safety filter and no detailed bias evaluation. It was trained on ordinary public photos and can reflect their biases. - Fine for experiments, learning how a diffusion-style model trains from scratch, and small decorative images. Do not use it for anything that needs accurate or realistic images of people or specific things. ## Files `final_ema_fp16.pt` (EMA weights, fp16, 98 MB) · `model.py` (architecture) · `generate.py` · `tokenizer/` · `samples/` Part of [Vertex AGI](https://vertexagi.dev), Sunstone family (everything that isn't text).