https://github.com/carperai/drlx

Diffusion Reinforcement Learning Library

https://github.com/carperai/drlx

Science Score: 33.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Committers with academic emails
    3 of 4 committers (75.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (8.3%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Diffusion Reinforcement Learning Library

Basic Info
  • Host: GitHub
  • Owner: CarperAI
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 4.46 MB
Statistics
  • Stars: 185
  • Watchers: 10
  • Forks: 8
  • Open Issues: 10
  • Releases: 0
Created about 3 years ago · Last pushed over 2 years ago
Metadata Files
Readme License

README.md

Diffusion Reinforcement Learning X

DRLX is a library for distributed training of diffusion models via RL. It is meant to wrap around 🤗 Hugging Face's Diffusers library and uses Accelerate for Multi-GPU and Multi-Node (as of yet untested)

News (09/27/2023): Check out our blog post with some recent experiments here!

📖 Documentation

Setup

First make sure you've installed OpenCLIP. Afterwards, you can install the library from pypi:

sh pip install drlx

or from source:

sh pip install git+https://github.com/CarperAI/DRLX.git

How to use

Currently we have only tested the library with Stable Diffusion 1.4, 1.5, and 2.1, but the plug and play nature of it means that realistically any denoiser from most pipelines should be usable. Models saved with DRLX are compatible with the pipeline they originated from and can be loaded like any other pretrained model. Currently the only algorithm supported for training is DDPO.

```python from drlx.rewardmodelling.aesthetics import Aesthetics from drlx.pipeline.pickapicprompts import PickAPicPrompts from drlx.trainer.ddpo_trainer import DDPOTrainer from drlx.configs import DRLXConfig

We import a reward model, a prompt pipeline, the trainer and config

pipe = PickAPicPrompts() config = DRLXConfig.loadyaml("configs/mycfg.yml") trainer = DDPOTrainer(config)

trainer.train(pipe, Aesthetics()) ```

And then to use a trained model for inference:

python pipe = StableDiffusionPipeline.from_pretrained("out/ddpo_exp") prompt = "A mad panda scientist" image = pipe(prompt).images[0] image.save("test.jpeg")

Accelerated Training

bash accelerate config accelerate launch -m [your module]

Roadmap

  • [x] Initial launch and DDPO
  • [x] PickScore Tuned Models
  • [ ] DPO
  • [ ] SDXL support

Owner

  • Name: CarperAI
  • Login: CarperAI
  • Kind: organization

GitHub Events

Total
  • Issues event: 1
  • Watch event: 17
  • Fork event: 1
Last Year
  • Issues event: 1
  • Watch event: 17
  • Fork event: 1

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 134
  • Total Committers: 4
  • Avg Commits per committer: 33.5
  • Development Distribution Score (DDS): 0.306
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
shahbuland s****1@g****m 93
Tanishq Abraham t****m@u****u 29
Shahbuland Matiana s****n@u****a 10
Nathan Cooper n****1@w****u 2
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 13
  • Total pull requests: 20
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 8 days
  • Total issue authors: 9
  • Total pull request authors: 3
  • Average comments per issue: 1.08
  • Average comments per pull request: 0.25
  • Merged pull requests: 17
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • TingTingin (3)
  • tmabraham (3)
  • shahbuland (1)
  • nbardy (1)
  • slavakurilyak (1)
  • bghira (1)
  • raineydavid (1)
  • rahulseetharaman (1)
Pull Request Authors
  • shahbuland (14)
  • tmabraham (4)
  • aandyw (2)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

docs/requirements.txt pypi
  • accelerate *
  • diffusers *
  • einops *
  • fastprogress *
  • matplotlib *
  • sphinx_rtd_theme *
  • torch *
  • torchtyping *
  • torchvision *
  • tqdm *
  • transformers *
  • wandb *
  • xformers *
pyproject.toml pypi
requirements.txt pypi
  • accelerate *
  • diffusers *
  • einops *
  • fastprogress *
  • matplotlib *
  • torch *
  • torchtyping *
  • torchvision *
  • tqdm *
  • transformers *
  • wandb *
  • xformers *
src/drlx.egg-info/requires.txt pypi
  • accelerate *
  • black *
  • box2d-py ==2.3.8
  • diffusers *
  • einops *
  • fastprogress *
  • flake8 *
  • flake8-pyproject *
  • graphviz *
  • ipython *
  • isort *
  • matplotlib *
  • mypy *
  • openai *
  • pre-commit *
  • pydocstyle *
  • pygame *
  • pygraphviz *
  • pytest *
  • pytest-cov *
  • sphinx ==5.3.0
  • sphinx_autodoc_typehints *
  • sphinx_rtd_theme *
  • swig >=4.1.0
  • torch *
  • torchtyping *
  • torchvision *
  • transformers *
  • tritonclient *
  • wandb *
  • xformers *