Skip to main content

Molecular reinforcement learning

Project description

Molecular Reinforcement Learning

Unlocking reinforcement learning for drug design

MRL is an open source python library designed to unlock the potential of drug design with reinforcement learning.

MRL bridges the gap between generative models and practical drug discovery by enabling fine-tuned control over chemical spaces. Control what structures are generated and where they occur.

MRL is suitable for all stages of drug discovery, from high diversity hit expansion screens to hyper-focused lead optimization

rgroup optimization

Use Cases

MRL can be applied to:

View our tutorials for more examples


Without Installing

MRL can be used without installing via Google Collab. Open any page in the documentation and click the "Open in Collab" button to open the notebook in Google Collab. Make sure to change the runtime to GPU.


MRL is available via Anaconda.

conda create -n mrl python=3.7
conda install -c dmai -c rdkit -c pytorch -c fastai -c conda-forge mrl
pip install selfies>=2.0.0


MRL is available via pypi. First install pytorch. Then run the following:

pip install mrl-pypi

Developer Install

If you plan to develop the library or want the most up to date release, use an editable install. First install pytorch. Then run the following:

git clone
pip install -e .

How to use

Here's an example of using a MRL pre-trained model to generate compounds based on the ChEMBL library:

from mrl.model_zoo import LSTM_LM_Small_Chembl

agent = LSTM_LM_Small_Chembl()

preds, log_probs = agent.model.sample_no_grad(512, 90)
smiles = agent.reconstruct(preds)


Getting Started

See the MRL documentation page for full documentaion

See the MRL tutorials page for examples


MRL uses nbdev for development. This allows us to build code, tests and documentation at the same time.

To contribute, install nbdev. Then run nbdev_install_git_hooks in your terminal. This sets up git hooks, which clean up the notebooks to remove the extraneous stuff stored in the notebooks which causes unnecessary merge conflicts.

If you make changes to a notebook, run nbdev_build_lib to update the library.

If you make changes to the library, run nbdev_update_lib to update the notebooks.

Submit PRs to the dev branch.

Before submitting a PR, run nbdev_diff_nbs to verify the notebooks and the library match.


MRl is built using many open source libraries. We would especially like to thank the development teams behind Pytorch, RDKit and fastai

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

mrl-pypi-0.1.5.tar.gz (97.5 kB view hashes)

Uploaded source

Built Distribution

mrl_pypi-0.1.5-py3-none-any.whl (109.9 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page