Linear combinations of latents in generative models: subspaces and beyond
This repository provides an implementation of LOL (Linear combinations Of Latent variables), as presented in the paper:
Linear Combinations of Latents in Generative Models: Subspaces and Beyond
Abstract
Sampling from generative models has become a crucial tool for applications like data synthesis and augmentation. Diffusion, Flow Matching and Continuous Normalizing Flows have shown effectiveness across various modalities, and rely on latent variables for generation. For experimental design or creative applications that require more control over the generation process, it has become common to manipulate the latent variable directly. However, existing approaches for performing such manipulations (e.g. interpolation or forming low-dimensional representations) only work well in special cases or are network or data-modality specific. We propose Linear combinations of Latent variables (LOL) as a general-purpose method to form linear combinations of latent variables that adhere to the assumptions of the generative model. As LOL is easy to implement and naturally addresses the broader task of forming any linear combinations, e.g. the construction of subspaces of the latent space, LOL dramatically simplifies the creation of expressive low-dimensional representations of high-dimensional objects.
Usage
To see the LOL method in use, please see the provided example notebooks:
example_interpolation.ipynb– Demonstrates simple interpolation.example_subspace.ipynb– Illustrates how latent subspaces can be defined.example_grid.ipynb– Similar as above but directly using linear combination weights.
from lolatents.lol_numpy import lol_iid
# from lolatents.lol_torch import lol_iid # for PyTorch
latents = lol_iid(
w=w_grid_including_remaining,
X=seed_latents,
cdf=latent_distribution.cdf,
inverse_cdf=latent_distribution.ppf
)
Installation
To use this repository, clone it and install dependencies:
git clone https://github.com/bodin-e/linear-combinations-of-latents.git
cd linear-combinations-of-latents
pip install -r requirements.txt
Metadata
Release files for lolatents 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lolatents-0.1.1.tar.gz | 5.9 kB | Without provenance | Details for lolatents-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lolatents-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for lolatents-0.1.1-py3-none-any.whl |
Total release size: 11.8 kB
Release files / lolatents-0.1.1.tar.gz
| Download URL | lolatents-0.1.1.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7db680f1902d27fe3979c9167cc1b649dabd0b0c4f243241f0aaa2ac34117ab1
|
|
BLAKE2b-256 checksum How to use checksums |
ef8c71052856833bc04ef629d13095113c6ddcca00a365c3e3cb7766575f936d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.12
|
Release files / lolatents-0.1.1-py3-none-any.whl
| Download URL | lolatents-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
38e5fb50dc88b63d7c2f844f572d0768d01b30fb40d785ac59b9180b377203b4
|
|
BLAKE2b-256 checksum How to use checksums |
ad90b97f5aa6dc1988774890ecca03e0711c45ba36accec520db83b437fb37d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.12
|
Security for lolatents 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.