Skip to main content

Toolkit to form subspaces of latent spaces and more in diffusion models and other latent variable models.

Project description

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

Alt text

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:

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lolatents-0.1.1.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lolatents-0.1.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file lolatents-0.1.1.tar.gz.

File metadata

  • Download URL: lolatents-0.1.1.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for lolatents-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7db680f1902d27fe3979c9167cc1b649dabd0b0c4f243241f0aaa2ac34117ab1
MD5 e094bfd88b82c89ab2d0b92f2a3e3bd3
BLAKE2b-256 ef8c71052856833bc04ef629d13095113c6ddcca00a365c3e3cb7766575f936d

See more details on using hashes here.

File details

Details for the file lolatents-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: lolatents-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for lolatents-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 38e5fb50dc88b63d7c2f844f572d0768d01b30fb40d785ac59b9180b377203b4
MD5 9dfc6195da7a474496dd1b420ed01617
BLAKE2b-256 ad90b97f5aa6dc1988774890ecca03e0711c45ba36accec520db83b437fb37d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page