Pytorch model training and optimization
Curated, evidence-grounded skill and software-tool collections for scientific AI agents, generated by the AgenticScienceBuilder
npx -y skills add HolobiomicsLab/asb-skill-collections --skill pytorch-model-training-and-optimizationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 14 stars14 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Use when when you have preprocessed molecular graph representations (from Preprocess.py or equivalent) and need to train a regression model to predict continuous retention time targets.
The file declares its own license as CC-BY-4.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
6.5 KB, ~1.0k tokens by cl100k_base, as published. Nobody here has run it
PyTorch Model Training and Optimization
Summary
End-to-end training of a Graph Neural Network (GNN) model on preprocessed molecular graph data to predict liquid chromatography retention time values. This skill encompasses model initialization, loss function configuration, iterative batch training with convergence monitoring, and checkpoint serialization.
When to use
When you have preprocessed molecular graph representations (from Preprocess.py or equivalent) and need to train a regression model to predict continuous retention time targets. Apply this skill when your input is a set of molecular graphs with associated LC retention time labels and your goal is to produce a trained model checkpoint for inference or transfer learning.
When NOT to use
- Input data has not been preprocessed into molecular graph format; raw spectra or unprocessed SMILES strings require Preprocess.py first.
- Retention time labels are missing or incomplete; supervised training requires paired graph–target data.
- Goal is inference only on a pre-trained model; use a model loading and prediction skill instead of retraining.
Inputs
- Preprocessed molecular graph data in PyTorch format (output from Preprocess.py)
- Molecular graph representations (nodes, edges, features)
- Retention time labels (continuous numeric targets)
Outputs
- Trained GNN model checkpoint in PyTorch format
- Model state dictionary with learned weights and biases
- Training and validation loss curves (per epoch)
How to apply
Load preprocessed molecular graph data using Python and PyTorch; initialize a GNN architecture suitable for end-to-end learning on graph-structured molecular representations. Configure a training loop with a regression loss function (e.g., MSE) and an appropriate optimizer (e.g., Adam). Iterate over training batches, computing forward passes through the GNN to generate predicted retention time values, backpropagating loss, and updating model parameters. At each epoch, validate model performance on a held-out validation set to monitor for convergence and overfitting. When validation performance stabilizes or training loss plateaus, save the trained model checkpoint in PyTorch format (.pt or .pth) to enable downstream transfer learning or inference on new molecules.
Related tools
- PyTorch (Deep learning framework for constructing, training, and serializing the GNN model architecture and optimizer)
- Python (Programming language for implementing the training loop, data loading, and model checkpoint management)
- RDKit (Molecular cheminformatics library for validating molecular graph representations during preprocessing and training)
Examples
python Train.py # After running Preprocess.py; trains GNN model on preprocessed molecular graphs and saves checkpoint
Evaluation signals
- Training loss decreases monotonically (or with expected variance) over epochs; validation loss exhibits convergence behavior without sustained divergence.
- Model checkpoint file is successfully written to disk in PyTorch format and can be reloaded without serialization errors.
- Validation-set predictions on held-out molecules fall within reasonable range for the target domain (e.g., retention time in expected chromatographic window); compare predicted vs. observed values using R² or RMSE.
- No NaN or Inf values in loss function or gradients during training; model parameters are updated and differ from initialization.
- Trained model can be loaded and used for inference (Transferlearning.py or downstream prediction) without dimension mismatches or type errors.
Limitations
- GNN-RT is designed specifically for small molecule retention time prediction; applicability to macromolecules or peptides is not addressed in the documentation.
- Accuracy of retention time prediction is sensitive to the quality and diversity of the training dataset; small or biased in-house databases may produce poor generalization.
- No changelog is available, limiting reproducibility across versions and making it difficult to track breaking changes or bug fixes.
- Training hyperparameters (learning rate, batch size, regularization, stopping criteria) are not explicitly detailed in the README; practitioners must reverse-engineer or tune empirically.
Evidence
- [other] Load preprocessed molecular graph data; initialize GNN; configure training loop; iterate over batches; validate per epoch; save checkpoint: "Load preprocessed molecular graph data (output from Preprocess.py) using Python and PyTorch. 2. Initialize a GNN architecture for end-to-end learning with molecular graph representations. 3."
- [intro] End-to-end GNN learning produces data-driven molecular representations for retention time prediction: "The GNN-RT can obtain the data-driven representations of molecules through the end-to-end learning with GNN, and predict the retention time with the GNN-learned representations."
- [readme] Workflow sequence: Preprocess.py → Train.py → optional Transferlearning.py: "run [Preprocess.py], [Train.py] and [Transferlearning.py]"
- [intro] GNN-RT improves accuracy of structural identification by predicting LC retention time for small molecules: "GNN-RT method, which is proved to be an effective way to predict small molecule LC retention time and improve the accuracy of structural identification of small molecules"
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.