Skip to content

Qqq-22-Rere/tftf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TFTF: Training-Free Targeted Flow

This repository contains the experiment code for TFTF: Training-Free Targeted Flow for Conditional Sampling, accepted to ICML 2026.

Repository Layout

tftf/
  experiments/
    mnist.py        # MNIST class-conditional sampling
    cifar10.py      # CIFAR-10 class-conditional sampling
    celeba_hq.py    # CelebA-HQ text-guided sampling
models/
  mnist/            # MNIST flow checkpoint is included
  cifar10/          # Download CIFAR-10 checkpoints here
  celeba_hq/        # Download CelebA-HQ and CLIP checkpoints here
prompts/
  celeba_hq_prompts.json
scripts/
  run_*.sh, run_*.ps1

Setup

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

On Windows PowerShell:

python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt

CUDA is recommended for all experiments. CPU execution is possible in principle, but the CIFAR-10 and CelebA-HQ experiments are very slow without a GPU.

Model Files

The MNIST unconditional flow checkpoint is included at:

models/mnist/final_model.pt

Other pretrained models and likelihood models must be downloaded separately. See models/README.md for links and exact target paths.

Paper Defaults

  • --stochastic_scale c means the SDE stochasticity schedule is alpha(t) = c / t.
  • --guidance_scale corresponds to the paper guidance scale beta(t).
Dataset Samples Steps Stochasticity Guidance Resampling interval
MNIST 16 800 alpha(t)=4/t beta(t)=1 [3/16, 1/2]
CIFAR-10 16 800 alpha(t)=4/t beta(t)=1 [7/16, 14/16]
CelebA-HQ 25 400 alpha(t)=2/t beta(t)=1 [3/40, 2/5]

Run

MNIST:

python -m tftf.experiments.mnist

CIFAR-10:

python -m tftf.experiments.cifar10

CelebA-HQ:

python -m tftf.experiments.celeba_hq --attribute Female

Outputs are written under outputs/ by default. The shell scripts in scripts/ run the same module entry points and pass through any additional arguments.

CelebA-HQ Prompts

Prompt configurations are stored in prompts/celeba_hq_prompts.json. Select a prompt by its attribute field:

python -m tftf.experiments.celeba_hq --attribute "Female + Smiling"

Citation

@inproceedings{qu2026tftf,
  title = {TFTF: Training-Free Targeted Flow for Conditional Sampling},
  author = {Qu, Qianqian and Liu, Jun S.},
  booktitle = {Proceedings of the 43rd International Conference on Machine Learning},
  year = {2026}
}

About

TFTF: Training-Free Targeted Flow for Conditional Sampling

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages