Practical overview
When it fits
Use GANformer when you need research code for image generation with a transformer-based GAN, or want to examine its training, evaluation, and pretrained-model workflows.
Who it is for
- Researchers studying generative models, transformer architectures, or compositional image generation.
- Developers who want to generate images from the included pretrained GANformer models.
- Practitioners comparing TensorFlow and PyTorch implementations of a generative adversarial transformer.
Documented uses
- Generate images from a pretrained checkpoint and save them to an output directory.
- Adjust the generation quality–diversity trade-off with the truncation setting.
- Train or evaluate a GANformer model using the repository's scripts.
- Study how latent components and image features interact during synthesis.
Requirements & limits
The repository is public and identifies its license as MIT.
- Choose between the TensorFlow implementation and the separate PyTorch version; the documented framework requirements differ.
- The custom TensorFlow/PyTorch operations compile with NVCC, so CUDA setup is part of the environment requirements.
- The README assumes 12 GB of GPU memory and reports experiments on a Titan V GPU.
- The 1024 × 2048 Cityscapes generation example is documented for the TensorFlow version only.
- The repository lists pretrained models at 256 × 256 across datasets, plus 1024 × 1024 FFHQ and 1024 × 2048 Cityscapes checkpoints.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Generate images from a pretrained bedroom model
Use the documented generation script and pretrained bedroom checkpoint to create 32 images.
Before you start
- A local GANformer checkout and its Python package requirements installed.
- A compatible TensorFlow or PyTorch setup; Python 3.6 or 3.7 is supported.
- CUDA toolkit and cuDNN environment for the custom operations; the README documents CUDA 10.0 and cuDNN 7.5, and assumes 12 GB of GPU memory.
Steps
Run the generation script with the documented checkpoint and output options: the command below.
python generate.py --gpus 0 --model gdrive:bedrooms-snapshot.pkl --output-dir images --images-num 32Optionally set
--truncation-psito adjust the quality–diversity trade-off; the README recommends experimenting between 0.6 and 1.0.
Expected outcome
The script downloads a pretrained model and generates images in the specified output directory.
Guide limitations
- The README describes CUDA custom operations and notes that a failed PyTorch kernel build can use a slower reference implementation.
- The documented memory assumption is 12 GB of GPU memory; actual performance may vary.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 18 October 2026
- Original website title
- dorarad/gansformer · Official homepage title · retained in its source language

