schrodinger.application.transforms.genml module

Generative ML transforms for molecular design.

Provides REINVENT-based generative model transforms that can be used standalone or as part of an active learning pipeline. The core workflow is: train a prior on input molecules, then generate novel molecules using the prior with optional ML model scoring and property filtering.

These transforms are generic and workflow-agnostic. Workflow-specific post-processing (e.g., filter cascades) can be added downstream of GenerateFromPrior.

class schrodinger.application.transforms.genml.TrainPriorConfig(*, num_epoch_smiles: int = 2000000, batch_size: int = 128)

Bases: BaseModel

Configuration for TrainPrior.

Parameters:
  • num_epoch_smiles – Target number of SMILES to train on. The number of epochs is computed as ceil(num_epoch_smiles / num_training_smiles).

  • batch_size – Number of SMILES per training batch.

model_config: ClassVar[ConfigDict] = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

num_epoch_smiles: int
batch_size: int
class schrodinger.application.transforms.genml.TrainPrior(**kwargs)

Bases: _LocalOnlyPTransform, TrainPrior

Train a generative ML prior model on input molecules.

The result is a ZipBlob containing the serialized model. The minimum number of Mols required to train is equal to the batch size.

class schrodinger.application.transforms.genml.GenerateFromPriorConfig(*, profile: dict[str, typing.Annotated[tuple[int | float, int | float], AfterValidator(func=<function _range_validator at 0x77a3d50acb80>)]] = {}, required_smarts: list[typing.Annotated[str, AfterValidator(func=<function _smarts_validator at 0x77a3d50acfe0>)]] = [], cpu_hours: int = 20, n_steps: int = 200, n_compounds: int = 20000, config_override: dict = {})

Bases: BaseModel

Configuration for GenerateFromPrior.

Parameters:
  • profile – Property ranges in REINVENT naming convention.

  • required_smarts – SMARTS patterns that generated molecules must match.

  • cpu_hours – CPU hours budget; determines number of parallel generation sessions.

  • n_steps – Optimization steps per generation session.

  • n_compounds – Compounds to generate per session.

  • config_override – REINVENT config overrides applied on top of DEFAULT_GENERATE_CONFIG.

model_config: ClassVar[ConfigDict] = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

profile: dict[str, typing.Annotated[tuple[int | float, int | float], AfterValidator(func=<function _range_validator at 0x77a3d50acb80>)]]
required_smarts: list[typing.Annotated[str, AfterValidator(func=<function _smarts_validator at 0x77a3d50acfe0>)]]
cpu_hours: int
n_steps: int
n_compounds: int
config_override: dict
class schrodinger.application.transforms.genml.GenerateFromPrior(ml_model_blobs: dict[str, ZipBlob] | None = None, ml_model_targets: dict[str, tuple[int | float, int | float]] | None = None, **kwargs)

Bases: PTransformWithConfig

Generate unique molecules from a trained prior.

Takes a ZipBlob containing a trained prior model and generates molecules using REINVENT optimization. Results are deduplicated across all generation sessions. Optionally accepts ML model blobs as scoring components during generation.

Configuration parameters are documented in GenerateFromPriorConfig.

Parameters:
  • ml_model_blobs – Optional trained ML models, mapping model names to ZipBlob instances. When models are produced at pipeline runtime (e.g., in AL-Pareto), callers should wrap the PCollection in AsSingleton before passing it here.

  • ml_model_targets – Target specs for ML model properties, keyed by model name.

config_class

alias of GenerateFromPriorConfig

HOURS_PER_BLOB = 4
__init__(ml_model_blobs: dict[str, ZipBlob] | None = None, ml_model_targets: dict[str, tuple[int | float, int | float]] | None = None, **kwargs)

Initialize the transform with configuration.

All keyword arguments are passed to the config_class constructor to create a validated configuration instance stored as self.config.

Parameters:

kwargs – Configuration parameters for the config_class

Raises:
  • AttributeError – If config_class is not defined on the subclass

  • ValidationError – If the configuration parameters are invalid

class schrodinger.application.transforms.genml.MoleculeGenerator(ml_models: Optional[PCollection[MLModel]] = None, ml_model_targets: dict[str, tuple[int | float, int | float]] | None = None, post_process: apache_beam.transforms.ptransform.PTransform | None = None, **kwargs)

Bases: PTransformWithConfig

High-level transform that generates molecules from a trained prior.

Orchestrates ML model collection, generation via GenerateFromPrior, and post-processing. By default, generated Chem.Mol objects are converted to Structure via MolToStructure().

Parameters:
  • ml_models – Optional PCollection of MLModel instances. When provided, models are combined into a blob dictionary and used as scoring components during generation.

  • ml_model_targets – Target specs for ML model properties, keyed by model name.

  • post_process – Optional PTransform to apply after generation. Defaults to MolToStructure().

config_class

alias of GenerateFromPriorConfig

__init__(ml_models: Optional[PCollection[MLModel]] = None, ml_model_targets: dict[str, tuple[int | float, int | float]] | None = None, post_process: apache_beam.transforms.ptransform.PTransform | None = None, **kwargs)

Initialize the transform with configuration.

All keyword arguments are passed to the config_class constructor to create a validated configuration instance stored as self.config.

Parameters:

kwargs – Configuration parameters for the config_class

Raises:
  • AttributeError – If config_class is not defined on the subclass

  • ValidationError – If the configuration parameters are invalid