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.0.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.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lolatents-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 9531c33b0b5a28be96402b24c160586f9965be08cc4650e552f4135e9dfb57ff
MD5 e864b23054bf74789b8dd16f36563fac
BLAKE2b-256 5a933b7bd4ddc78e41c49f54139e012c1a9bf14d08cfaaaf4d316cdc702f7286

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lolatents-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 649e012a53c5a7b9d81b2ae029970c61d8e383c6932cb1468429109620e288dd
MD5 21ee9e3d1cfa9bbcecd0e111085b034e
BLAKE2b-256 9113762d9c35850e00d46c05c4b2cf83df004497496b7bafe8159d70b46be8be

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