How explainingai-code/vqvae-pytorch works
This is a PyTorch VQ-VAE implementation for grayscale and colored MNIST, with an optional LSTM that models sequences of VQ-VAE codebook indices to generate digits. The main workflow trains the VQ-VAE, runs inference to produce reconstructions and saved encodings, trains the LSTM on those encodings, then samples indices and decodes them into images. The graph includes the documented minimal standalone VQ-VAE path. Relationships are limited to those visible in excerpts or explicitly described in the README; configuration files and data contents were not inspected.
Main entry points: infer_vqvae.py Inference · generate_images.py Image Generation · vqvae.py VQ-VAE Model · train_vqvae.py VQ-VAE Trainer
Components 18
Data
- Run Config
config - MNIST Dataset
dataset/mnist_dataset.py
VQ-VAE
- VQ-VAE Trainer
tools/train_vqvae.py - Encoder
model/encoder.py - Codebook Quantizer
model/quantizer.py - Decoder
model/decoder.py - VQ-VAE Model
model/vqvae.py - Simple VQ-VAE
run_simple_vqvae.py - Inference
tools/infer_vqvae.py
Sequence Generation
- LSTM Trainer
tools/train_lstm.py - LSTM Model
tools/train_lstm.py - Image Generation
tools/generate_images.py
Run Artifacts
- Code Encodings
- VQ-VAE Checkpoint
- LSTM Checkpoint
- Generated Images
- Reconstructions
Other components
- Engineer
Connections 30
- Engineer → VQ-VAE Trainer: starts training
README.md - Run Config → VQ-VAE Trainer: configures
tools/train_vqvae.py - VQ-VAE Trainer → MNIST Dataset: loads images
tools/train_vqvae.py - VQ-VAE Trainer → VQ-VAE Model: trains
tools/train_vqvae.py - VQ-VAE Model → Encoder: encodes
model/vqvae.py - VQ-VAE Model → Codebook Quantizer: quantizes
model/vqvae.py - VQ-VAE Model → Decoder: decodes
model/vqvae.py - VQ-VAE Trainer → VQ-VAE Checkpoint: saves weights
tools/train_vqvae.py - Engineer → Inference: starts inference
README.md - Run Config → Inference: configures
tools/infer_vqvae.py - Inference → VQ-VAE Model: runs model
tools/infer_vqvae.py - Inference → MNIST Dataset: loads images
tools/infer_vqvae.py - Inference → VQ-VAE Checkpoint: loads weights
tools/infer_vqvae.py - Inference → Code Encodings: writes encodings
tools/infer_vqvae.py - Inference → Reconstructions: saves
tools/infer_vqvae.py - Engineer → LSTM Trainer: starts training
README.md - Run Config → LSTM Trainer: configures
tools/train_lstm.py - LSTM Trainer → Code Encodings: loads encodings
tools/train_lstm.py - LSTM Trainer → LSTM Model: trains
tools/train_lstm.py - LSTM Trainer → LSTM Checkpoint: saves weights
tools/train_lstm.py - Engineer → Image Generation: starts generation
README.md - Run Config → Image Generation: configures
tools/generate_images.py - Image Generation → LSTM Checkpoint: loads weights
tools/generate_images.py - Image Generation → LSTM Model: samples indices
tools/generate_images.py - Image Generation → VQ-VAE Checkpoint: loads weights
tools/generate_images.py - Image Generation → VQ-VAE Model: decodes indices
tools/generate_images.py - Image Generation → Generated Images: saves
tools/generate_images.py - Engineer → Simple VQ-VAE: runs demo
README.md - Simple VQ-VAE → MNIST Dataset: loads images
run_simple_vqvae.py - Simple VQ-VAE → Reconstructions: saves
run_simple_vqvae.py