Skip to main content

Diffusion Gym

Project description

Diffusion Gym

License Code style: ruff

diffusiongym is a library for reward adaptation of any pre-trained flow model on any data modality.

Installation

In order to install diffusiongym, execute the following command:

pip install diffusiongym

diffusiongym requires PyTorch 2.3.1, and there may be other hard dependencies. Please open an issue if installation fails through the above command.

Molecule environments depend on FlowMol, which currently needs to be installed manually:

pip install git+https://github.com/cristianpjensen/FlowMol.git@8f4c98cbe68111e4e63480b250d925b6d960d3bc

Some image rewards depend on the clip package, which needs to be installed manually as well:

pip install git+https://github.com/openai/CLIP.git

High-level overview

Diffusion and flow models are largely agnostic to their data modality. They only require that the underlying data type supports a small set of operations. Building on this idea, diffusiongym is designed to be fully modular. You only need to provide the following:

  • Data type YourDataType that implements DDProtocol, which defines some functions necessary for interacting with it as a flow model.
  • Base model BaseModel[YourDataType], which defines the scheduler, how to sample $p_0$, how to compute the forward pass, and how to preprocess and postprocess data.
  • Reward function Reward[YourDataType].

Once these are defined, you can sample from the flow model and apply reward adaptation methods, such as Value Matching.

Documentation

Much more information can be found in the documentation, including tutorials and API references.

Citation

If this library is useful to you, consider citing the following work:

@inproceedings{jensen2026value,
  title={Value Matching: Scalable and Gradient-Free Reward-Guided Flow Adaptation},
  author={Cristian Perez Jensen and Luca Schaufelberger and Riccardo De Santi and Kjell Jorner and Andreas Krause},
  booktitle={The Fourteenth International Conference on Learning Representations},
  year={2026},
}

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

diffusiongym-2.0.1.tar.gz (5.0 MB view details)

Uploaded Source

Built Distribution

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

diffusiongym-2.0.1-py3-none-any.whl (623.1 kB view details)

Uploaded Python 3

File details

Details for the file diffusiongym-2.0.1.tar.gz.

File metadata

  • Download URL: diffusiongym-2.0.1.tar.gz
  • Upload date:
  • Size: 5.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for diffusiongym-2.0.1.tar.gz
Algorithm Hash digest
SHA256 3a6df34dad3774c0637d66b023487a190365f87c85331aed21af6ba2e994bbdc
MD5 91c69914c8f02b5daca981dc156c73a6
BLAKE2b-256 6e00246cd4bdd2ebd73f45fbcd02c45164a925f2013e8ca75fce0e746b700a5c

See more details on using hashes here.

Provenance

The following attestation bundles were made for diffusiongym-2.0.1.tar.gz:

Publisher: release.yml on cristianpjensen/diffusiongym

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file diffusiongym-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: diffusiongym-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 623.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for diffusiongym-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 07d878986fd8ac11a67fe19d9872efdc1763e3311dd8e8a21124a2cc49761110
MD5 80d1f73daca168ab392f08965d9f56b4
BLAKE2b-256 e8b487da310372335602fa84d28e8a7febad05f5f9d56a0f24497ce5e1309ef9

See more details on using hashes here.

Provenance

The following attestation bundles were made for diffusiongym-2.0.1-py3-none-any.whl:

Publisher: release.yml on cristianpjensen/diffusiongym

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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