Skip to content

Latest commit

 

History

History
126 lines (87 loc) · 4.6 KB

breaking_down_configuration_files.md

File metadata and controls

126 lines (87 loc) · 4.6 KB

Tutorial: Breaking down configuration files


In this tutorial, we will explore the structure of configuration files used in ACEGEN training scripts. These configuration files are designed to be uniform, simplifying parameter management for experiments employing different modes and algorithms.

Configuration File Structure

Below is the general structure of our configuration file:

# Logging configuration
...

# Environment configuration
...

# Scoring function
...

# Promptsmiles configuration
...

# Model architecture
...

# Optimizer configuration
...

# Algorithm configuration
...

# Data replay configuration
...

We will take the example scripts/reinvent/config_denovo.yaml, the config file for the novo generation using the REINVENT algorithm to break down each seaction.

Logging configuration

This section remains consistent across all scripts:

# Logging configuration
experiment_name: acegen # Used for logging to WandB or TensorBoard
agent_name: reinvent # Used for logging to WandB or TensorBoard
log_dir: results # Path where results will be saved
logger_backend: null  # WandB, TensorBoard, or null
seed: 101 # Set the seed of each experiment. Multiple seeds can be provided as a list for sequential experiments, e.g., [101, 102, 103]

Environment configuration

Consistent across all scripts, this section allows defining the number of molecules to generate in parallel in each iteration, as well as the total size of the generated library of molecules:

# Environment configuration
num_envs: 128 # Number of SMILES to generate in parallel
total_smiles: 10_000 # Total number of SMILES to generate

Scoring function

This section is also common to all scripts. ACEGEN uses molscore by default to define scoring functions to guide the generative agents with reinforcement learning. However, molscore is only an optional dependency. The custom_task also allows to directly use a custom scoring function defined by the user. Check our tutorial to learn how to define and use your own scoring function.

# Scoring function
molscore_mode: single # single (run a single objective), benchmark (run multiple), or curriculum (run a sequence)
molscore_task: MolOpt:Albuterol_similarity # accepts task configuration path (JSON), benchmark (preset only), or curriculum task (preset only). In this case it select a specific ibjective from the MolOpt benchmark
custom_task: null # Requires molscore to be set to null. Allows to select a custom scoting function.

Promptsmiles configuration

This section is different for de novo, decorative and fragment linking scripts. To learn how to configure prompsmiles properly for each of these case, please refere to out promptsmiles tutorial.

# Promptsmiles configuration
prompt: null  # e.g. c1ccccc

Model architecture

ACEGEN provide a few model options to select from. However, we also allow users to integrate their own models into AceGen.

A detailed guide on integrating custom models can be found in this tutorial.

# Model architecture
model: gru # gru, lstm, or gpt2, mamba, llama2, etc
# The default prior varies for each model. Refer to the README file in the root directory for more information.
# The default vocabulary varies for each prior. Refer to the README file in the root directory for more information.
custom_model_factory: null # Path to a custom model factory (e.g. my_module.create_model)

Optimizer configuration

This section is the same in all scripts. Allows to configure the learning rate and other parameter of the training optimizer.

# Optimizer configuration
lr: 0.0001
eps: 1.0e-08
weight_decay: 0.0

Algorithm configuration

This section varies for each algorithm and allows you to define its hyperparameters. Please refer to the paper for each algorithm to learn how to modify them. Links to the papers are provided in the README.md file.

# Reinvent configuration
sigma: 120

Data replay configuration

Data replay is a technique often used in reinforcement learning to improve sample efficiency and stabilize training. This section allows you to configure data replay settings for your ACEGEN training scripts.

# Data replay configuration
experience_replay: True
replay_buffer_size: 100  # Size of the replay buffer in number of molecules
replay_batch_size: 10  # Size of the batch that will be sampled in every iteration to mix with the data generated by the RL agent.