Practical overview
When it fits
Use it when a Python project needs a transformer autoencoder with spline-based latent control points, or when exploring how edits to those points affect reconstructed sequences or images.
Who it is for
- Python developers experimenting with transformer autoencoders for sequential data.
- Researchers exploring latent spline representations and reconstruction.
- Developers building image-autoencoder experiments with the provided wrapper.
Documented uses
- Train a model to reconstruct sequential tensor data.
- Encode input data into spline control points and decode a reconstruction.
- Use the image wrapper to train and reconstruct image tensors.
- Modify latent control points and decode a controlled sequence or image reconstruction.
Requirements & limits
The repository is public and specifies the MIT license. The README documents installation with pip; its examples use Python and PyTorch.
- The representation is distinctive: latent tokens serve as high-dimensional spline control points.
- Sequence and image paths are both shown, with image support provided through a wrapper.
- The documented examples require training before reconstruction and use tensor inputs.
- The README illustrates continuity-preserving edits as an intended property, not a quantified guarantee.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Train and decode sequence data with spline latent control points
Train the transformer autoencoder on sequence data, then reconstruct it and decode a reconstruction from modified latent control points.
Before you start
- Python package
spline-based-transformerinstalled withpip install spline-based-transformer. - PyTorch available.
- Sequence data represented as a tensor; the example uses shape (1, 1024, 512).
Steps
Import
torchandSplineBasedTransformer, then create a model withdim=512,enc_depth=6, anddec_depth=6.Provide sequence data and calculate the training loss with
model(data, return_loss=True); callloss.backward()and train the model.After training, obtain
recon, control_points = model(data, return_latents=True).Modify the control points and decode with
model.decode_from_latents(control_points, num_times=1024). The README example adds 1 to the control points.
Expected outcome
The model returns a sequence reconstruction and latent control points; decoding the modified control points produces a controlled reconstruction with the same shape as the input in the documented example.
Guide limitations
- The README marks reconstruction as occurring after training but does not specify a training loop, optimizer, or duration.
- Continuity preservation from control-point edits is described as expected, not guaranteed.
Train and decode images with the image autoencoder wrapper
Use the image wrapper to train on image tensors, obtain latent control points, and decode after modifying them.
Before you start
- Python package
spline-based-transformerinstalled withpip install spline-based-transformer. - PyTorch available.
- Images represented as tensors; the example uses shape (2, 3, 256, 256).
Steps
Import
torch,SplineBasedTransformer, andImageAutoencoderWrapper.Create an
ImageAutoencoderWrapperwithimage_size=256,patch_size=32, and aSplineBasedTransformerconfigured withdim=512,enc_depth=6, anddec_depth=6.Calculate
loss = model(images, return_loss=True), callloss.backward(), and train the model.After training, obtain
recon_images, control_points = model(images, return_latents=True), modify the control points, and callmodel.decode_from_latents(control_points). The README example adds 1 to the control points.
Expected outcome
The wrapper returns reconstructed images and latent control points; decoding modified control points produces controlled reconstructed images with the input shape in the documented example.
Guide limitations
- The README does not specify a training loop, optimizer, or duration.
- The example documents the wrapper configuration and tensor dimensions but does not establish broader image-size or input-format support.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 16 October 2026
- Original website title
- lucidrains/spline-based-transformer · Official homepage title · retained in its source language

