The eval/ package hosts the FID pipeline and supporting utilities used during
training and offline benchmarking. Everything is written for multi-host JAX
setups, so loaders, samplers, and detectors are sharded-aware.
fid.py: end-to-end helpers for computing Fréchet Inception Distance. Exposescalculate_real_stats,calculate_cls_fake_stats, andcalculate_fidto compute reference dataset statistics, "fake" samples from model, and score them.utils.py: shared tooling—distributedDataLoaderconstruction for building the evaluation dataloader and calculate reference statistics, FID weight downloads (download), synchronization helpers (lock,all_gather), and detector bootstrap (get_detector).inception.py: a Flax/NNX InceptionV3 port with pretrained FID weights stored ineval/inception_v3_weights_fid.pickle. The module mirrors the PyTorch reference and returns pooled 2048-D features.
- Ensure
eval/inception_v3_weights_fid.pickleis present. If not, calleval.utils.download(url)to fetch it once, or mount it under~/diffuse_nnx/eval/. - Prepare reference dataset statistics. Either point
config.data.stat_dirto a pickled{"fid": {"mu": ..., "sigma": ...}}file, or letcalculate_real_statsingest your dataset and cache the stats manually. - Confirm your config populates
config.eval.detector="inception",config.eval.batch_size, andconfig.eval.inception_batch_size.
- Call
utils.lock()sparingly to keep distributed workers in sync; the FID loops already lock around shared buffers. - When running on Cloud TPU, pass
mesh(NamedShardingmesh from the trainer) socalculate_cls_fake_statscan broadcast state cheaply. - Keep evaluation deterministic by fixing
config.eval.seedand seedingnnx.Rngswith the same host-independent key.