How malswadi/tmgl works
TMGL is a molecular-property prediction framework: training loads labeled molecular records, turns SMILES into molecular graphs, derives topology and motif features, and trains a multi-level graph model for binary, multi-label, or regression tasks. Model inference encodes local, motif, and global representations, fuses them, and predicts task outputs; training evaluates validation metrics and saves the best checkpoint. The README documents the model capabilities, while sampled source confirms data preparation, model components, and trainer behavior; unsampled evaluation wiring is shown only where supported by the tree.
Main entry points: model.py Fusion and prediction · train.py Training entry · utils.py Batch preparation · Datasets Property datasets
Components 20
Molecular data
- Property datasets
Datasets - CSV loaders
src/utils.py - SMILES validation
src/utils.py - Molecule graphs
src/utils.py - Task splits
src/utils.py
Graph representations
- Topology features
src/utils.py - Motif features
src/utils.py - Batch preparation
src/utils.py
Model and learning
- GIN encoder
src/model.py - Graph transformer
src/model.py - Motif encoder
src/model.py - Contrastive loss
src/model.py - Topology loss
src/model.py - Motif consistency
src/model.py - Fusion and prediction
src/model.py
Training and evaluation
- Training entry
src/train.py - Task trainers
src/train.py - Evaluation entry
src/test.py - Best checkpoint
Other components
- Researcher
Connections 23
- Researcher → Training entry: starts training
- Property datasets → CSV loaders: supplies records
- Training entry → CSV loaders: loads task data
- CSV loaders → SMILES validation: validates molecules
- SMILES validation → Molecule graphs: converts SMILES
- Molecule graphs → Task splits: provides graphs
- Task splits → Batch preparation: batches splits
- Batch preparation → Topology features: extracts topology
- Batch preparation → Motif features: extracts motifs
- Training entry → Task trainers: runs task training
- Training entry → Batch preparation: prepares batches
- Task trainers → GIN encoder: invokes model
- GIN encoder → Graph transformer: encodes global context
- GIN encoder → Motif encoder: encodes motifs
- Fusion and prediction → GIN encoder: uses local features
- Fusion and prediction → Graph transformer: uses global features
- Fusion and prediction → Motif encoder: uses motif features
- Fusion and prediction → Contrastive loss: computes contrast
- Fusion and prediction → Topology loss: computes topology loss
- Fusion and prediction → Motif consistency: computes motif loss
- Task trainers → Fusion and prediction: trains and predicts
- Task trainers → Best checkpoint: saves best model
- Researcher → Evaluation entry: requests evaluation