How undeadpixel/reinvent-gdb13 works
Main components
• Input Data: SMILES files containing chemical structure data.
• Preprocessing/Vocabulary Creation: Code in the “models/reinvent” module (e.g., vocabulary.py and dataset.py) that processes input SMILES to extract or compute the vocabulary.
• Model Creation: The “create_model.py” script is used to generate an empty model configured with the right parameters (embedding layer size, number of GRU layers, and GRU layer size).
• Model Training: The “train_model.py” script that uses the created model and training data to adjust model parameters over a number of epochs.
• Model Sampling: The “sample_from_model.py” script which loads a trained model (from the trained_models folder) to generate chemical structures or retrieve log-likelihoods.
• Supporting Libraries and Environment: The environment.yml file shows that dependencies are managed via Conda.
Interactions between components
• Data Flow:
• SMILES Input → Preprocessing/Vocabulary Extraction (models/reinvent/dataset.py, vocabulary.py)
• Preprocessed Data → Model Creation (create_model.py) where the vocabulary is embedded into a blank model.
• Blank Model + Training Data → Model Training (train_model.py). Here, the GRU-based RNN learns the chemical space.
• Trained Model (saved in the “trained_models” folder) → Model Sampling (sample_from_model.py) to produce new SMILES or calculate log-likelihood.
• The components are loosely connected via file I/O, where intermediate files (empty model files and trained model files) are passed from one stage to the next.
Architectural patterns and design principles
• Modularity: The project leverages a module (models/reinvent) that encapsulates dataset handling, model definition, and utility functions for the RNN architecture.
• Pipeline/Workflow: There is a clearly defined workflow beginning with model creation, followed by training, and finally inference (sampling). Each step is handled by a dedicated script.
• Parameterization: Key hyperparameters (number of GRU layers, GRU layer size, embedding size) are exposed via command-line arguments, which enhances flexibility and reusability.
• Reproducibility: The inclusion of a Conda environment (environment.yml) ensures that the project can be set up with all required libraries easily.
Detailed Elements
• “Input SMILES Data”
• “Data Preprocessing & Vocabulary Extraction (dataset.py, vocabulary.py)”
• “Model Creation (create_model.py)”
• “Model Training (train_model.py)”
• “Trained Model Storage (trained_models folder)”
• “Model Sampling & Inference (sample_from_model.py)”
• Annotations for key hyperparameters and configuration options (e.g., GRU layer size, number of GRU layers, embedding layer size).
• External dependencies (like the Conda environment and any required libraries referenced in environment.yml).