Skip to main content

Flow Gym

Project description

Flow Gym

License Code style: ruff

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

Installation

In order to install flowgym, execute the following command:

pip install flowgym

flowgym 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, flowgym is designed to be fully modular. You only need to provide the following:

  • Data type YourDataType that implements FlowProtocol, 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.

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

flowgym-1.9.tar.gz (5.8 MB view details)

Uploaded Source

Built Distribution

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

flowgym-1.9-py3-none-any.whl (1.5 MB view details)

Uploaded Python 3

File details

Details for the file flowgym-1.9.tar.gz.

File metadata

  • Download URL: flowgym-1.9.tar.gz
  • Upload date:
  • Size: 5.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for flowgym-1.9.tar.gz
Algorithm Hash digest
SHA256 0c55b176ef9bbd98da661fbfb1f38661e4ea528b7b3a8ebbf43f811921d5aa73
MD5 2231e4489f8c63b83fcaa9e0059957f0
BLAKE2b-256 de3028bf8997b0da671d50273267aae65ae013f26a0655198c698de7fe03ef20

See more details on using hashes here.

File details

Details for the file flowgym-1.9-py3-none-any.whl.

File metadata

  • Download URL: flowgym-1.9-py3-none-any.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for flowgym-1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 0d5efa5a93d1f86239a056026b1041443cec39ec1fc3f377e96c4f760dae7101
MD5 b54f47d386eb9d3aebe3865327663b79
BLAKE2b-256 66f58d871a625667865c7086d29e2d4c0acab35a6507cf1987bc58eccf843bf3

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