AlignDRAW (resurrected) β€” one of the first text-to-image models

A trained-from-scratch PyTorch resurrection of AlignDRAW (Mansimov, Parisotto, Ba, Salakhutdinov β€” Generating Images from Captions with Attention, ICLR 2016), one of the earliest neural text-to-image models. The original Theano code shipped no pretrained weights and the framework is long dead β€” so this model was re-implemented in PyTorch and trained on the original still-online COCO 32Γ—32 caption data (cs.toronto.edu/~emansim), for mediasynthesismuseum/aligndraw.

It's a recurrent VAE that draws an image onto a canvas over 32 steps, attending to the caption words at each step (Bahdanau alignment) with a learned sequential prior. Output is a blurry 32Γ—32 blob whose colour/layout tracks the caption β€” exactly the fidelity the 2015 model had.

Files

  • aligndraw_coco.pt β€” trained weights (33M params; dims match the original coco-captions-32x32).
  • model.py β€” the faithful PyTorch AlignDRAW definition.
  • dictionary.pkl β€” the original 25,322-word caption dictionary (word β†’ index; includes UNK).

Usage

import torch, pickle
from model import AlignDRAW
m = AlignDRAW(); m.load_state_dict(torch.load("aligndraw_coco.pt", map_location="cpu")); m.eval()
d = pickle.load(open("dictionary.pkl","rb"), encoding="latin1")
toks = [d.get(w, d["UNK"]) for w in "a red stop sign on a street corner .".split()]
y = torch.tensor([toks]).expand(8, -1)
imgs = m.generate(y)  # (8, 3, 32, 32) in [0,1]

Credit: Elman Mansimov, Emilio Parisotto, Jimmy Ba, Ruslan Salakhutdinov (original AlignDRAW); built on DRAW (Gregor et al.).

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

Space using mediasynthesismuseum/aligndraw 1