Metadata-Version: 2.4
Name: flowgym
Version: 1.10
Summary: Flow Gym
Project-URL: Homepage, https://github.com/cristianpjensen/flowgym
Project-URL: Issues, https://github.com/cristianpjensen/flowgym/issues
Author: Cristian Perez Jensen
License: MIT License
        
        Copyright (c) 2025 Cristian Perez Jensen
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Requires-Python: <3.12,>=3.8
Requires-Dist: dgl==2.4
Requires-Dist: diffusers==0.33.1
Requires-Dist: image-reward<2,>=1.0
Requires-Dist: meeko==0.6.1
Requires-Dist: numpy<3,>=1.24
Requires-Dist: open-clip-torch<3,>=2.26
Requires-Dist: pandas<3,>=2
Requires-Dist: peft==0.5.0
Requires-Dist: polars<2,>=1.34.0
Requires-Dist: prody<3,>=2.4
Requires-Dist: pydantic<3,>=1.10
Requires-Dist: pyyaml<7,>=6
Requires-Dist: rdkit-stubs<0.9,>=0.6
Requires-Dist: rdkit<2025,>=2023.9.4
Requires-Dist: torch==2.3.1
Requires-Dist: torchdata<0.9,>=0.7
Requires-Dist: torchvision==0.18.1
Requires-Dist: tqdm<5,>=4.66
Requires-Dist: transformers<4.43,>=4.36
Requires-Dist: typing-extensions<5,>=4.9
Description-Content-Type: text/markdown

# Flow Gym

<div align="center">
  <img src="docs/_static/teaser.gif" width="100%" />
</div>

<p align="center">
<a href="https://github.com/cristianpjensen/flow-gym/blob/master/LICENSE"><img alt="License" src="https://img.shields.io/github/license/cristianpjensen/flowgym"></a>
<a href="https://github.com/astral-sh/ruff"><img alt="Code style: ruff" src="https://img.shields.io/badge/code%20style-ruff-000000.svg"></a>
</p>

`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:
```bash
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](https://github.com/cristianpjensen/FlowMol),
which currently needs to be installed manually:
```bash
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:
```bash
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](https://cristianpjensen.github.io/flowgym/), including tutorials and API references.
