Use when when you have preprocessed molecular graph representations (from
Scanned 9/12/2026
Install to Claude Code
npx -y skills add HolobiomicsLab/asb-skill-collections --skill pytorch-model-training-and-optimization --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Pytorch Model Training And Optimization?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/holobiomicslab-pytorch-model-training-and-optimization)More formats (shields.io, HTML) on the badges page.
---
name: pytorch-model-training-and-optimization
description: 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.
license: CC-BY-4.0
metadata:
edam_operation: http://edamontology.org/operation_3695
edam_topics:
- http://edamontology.org/topic_0154
- http://edamontology.org/topic_3372
tools:
- PyTorch
- Python
- RDKit
techniques:
- LC-MS
license_tier: open
provenance_tier: literature
derived_from:
- doi: 10.1021/acs.analchem.0c04071
title: GNN-RT
evidence_spans:
- conda install pytorch
- Anaconda for python 3.6
claims: []
provenance:
collection: https://w3id.org/holobiomicslab/asb-skill/collection/metabolomics/v2
assembled_by: scripts/collect_metabolomics_collection.py
sources:
- build: coll_gnn_rt_cq
doi: 10.1021/acs.analchem.0c04071
title: GNN-RT
dedup_kept_from: coll_gnn_rt_cq
schema_version: 0.2.0
attribution:
generator: AgenticScienceBuilder
original_doi: 10.1021/acs.analchem.0c04071
all_source_dois:
- 10.1021/acs.analchem.0c04071
zenodo_doi: 10.5281/zenodo.20794027
curators: []
promoter: Louis-Félix Nothias
sponsor: CNRS & Université Côte d'Azur
---
# 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"
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!