Useful callbacks for GANs, variational-autoencoders or anything with latent spaces.
We rely on the community to keep these updated and working. If something doesn’t work, we’d really appreciate a contribution to fix!
Latent Dim Interpolator¶
Interpolates latent dims.
- class pl_bolts.callbacks.variational.LatentDimInterpolator(interpolate_epoch_interval=20, range_start=- 5, range_end=5, steps=11, num_samples=2, normalize=True)
The feature LatentDimInterpolator is currently marked under review. The compatibility with other Lightning projects is not guaranteed and API may change at any time. The API and functionality may change without warning in future releases. More details: https://lightning-bolts.readthedocs.io/en/latest/stability.html
Interpolates the latent space for a model by setting all dims to zero and stepping through the first two dims increasing one unit at a time.
Default interpolates between [-5, 5] (-5, -4, -3, …, 3, 4, 5)
from pl_bolts.callbacks import LatentDimInterpolator Trainer(callbacks=[LatentDimInterpolator()])
- on_train_epoch_end(trainer, pl_module)
Called when the train epoch ends.
To access all batch outputs at the end of the epoch, either:
Implement training_epoch_end in the LightningModule and access outputs via the module OR
Cache data across train batch hooks inside the callback implementation to post-process in this hook.
- Return type