Practical overview
When it fits
Use Imagefolder when you need research code and configurable training workflows for image tokenizers, or want to examine how tokenizer checkpoints are used in a documented VAR inference procedure.
Who it is for
- Researchers studying discrete or visual token representations for images.
- Developers training or fine-tuning image tokenizers for autoregressive generation.
- Teams exploring VAR workflows that use tokenizer checkpoints.
Documented uses
- Train or fine-tune an image tokenizer on a class-folder dataset.
- Compare quantization configurations, including product and residual quantization.
- Use a tokenizer checkpoint in the documented VAR inference workflow.
- Explore latent perturbation and pFID evaluation described by the repository.
Requirements & limits
- The documented setup depends on a Conda environment, PyTorch distributed training and Weights & Biases login for training.
- Training or fine-tuning requires users to prepare datasets in a PyTorch ImageFolder-compatible class-directory structure.
- The README supplies model checkpoints and configurations, while directing users to adjust configurations for their dataset.
- The documented VAR inference command requires a checkpoint, ImageNet data and an external reference-batch file.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Prepare and train an image tokenizer
Set up the documented training workflow and start tokenizer training on a prepared image dataset.
Before you start
- Python environment created from the repository's environment.yml using Conda.
- Training and validation images arranged in class folders recognized by PyTorch ImageFolder.
- A Weights & Biases login for the documented training workflow.
Steps
Create the Conda environment with
conda env create -f environment.yml.Arrange the dataset with training and validation directories containing class subfolders and images.
Log in to Weights & Biases with
wandb login.Edit a configuration in
configsfor the dataset paths and desired tokenizer settings.Start training with
torchrun --nproc_per_node=8 tokenizer/tokenizer_image/xqgan_train.py --config configs/xxxx.yaml, substituting the chosen configuration file.
Expected outcome
The documented workflow reports rFID to Weights & Biases and saves the checkpoint with the best rFID on the validation set.
Guide limitations
- The README advises modifying the checkpoint-selection metric because rFID is not closely correlated with gFID; PSNR and SSIM are noted as alternatives.
- The configuration must be adapted for the specific dataset.
Run the documented VAR inference workflow
Follow the repository's command-line VAR inference procedure with a tokenizer checkpoint and ImageNet reference batches.
Before you start
- A checkpoint for the
--infer_ckptargument. - ImageNet data at the path supplied to
--data_path. - The reference-batch file downloaded from the OpenAI URL specified in the README.
Steps
Download
VIRTUAL_imagenet256_labeled.npzfrom the OpenAI URL given in the README.Set the checkpoint and ImageNet paths in the documented inference command.
Run the README's
torchruninference command with the selected model, token, patch and sampling parameters.
Expected outcome
The repository's VAR inference script is invoked with the specified checkpoint, ImageNet data and generation settings.
Guide limitations
- The README provides a command template with particular model and sampling parameters; it does not describe a general-purpose inference API.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 20 November 2026
- Original website title
- lxa9867/ImageFolder · Official homepage title · retained in its source language

