How chauttm/rt works
Project type and purpose
• This is a machine-learning experiment repository, not a web or microservice application.
• Purpose: Train and evaluate a transformer-based model for predicting retention times (RT) in LC-MS proteomics. It supports hyperparameter tuning, model training, hold-out testing, and ad-hoc prediction.
File structure
• Top-level scripts:
• rt.py – hyperparameter tuning CLI
• train.py – model training CLI
• train_nano.py – variant of training CLI
• predict.py – prediction/inference CLI
• dataloader.py – dataset loading / batching logic
• model.py – transformer model definition
• configurator.py – configuration assembly (e.g., default arguments)
• utils/… – helper modules (optimization, plotting, FP utilities)
• Data:
• data/*.npy and .csv files for multiple datasets (Prosit, AutoRT, DeepDIA, Phospho)
• Persistence:
• models/<experiment_name>/* – trained model weights, parameter logs, history CSVs
• output.txt, rt.txt – miscellaneous outputs
• Other:
• images/graphical-abstract.png for documentation
• Jupyter notebook (Untitled.ipynb)
README for additional insights
• Tech stack: Python 3.10, PyTorch, NumPy, CSV/TSV I/O, TensorBoard logs optionally.
• Workflow steps described: tuning, training, testing, predicting.
a. Main components
• Data Storage (Raw datasets on disk: .npy, .csv)
• Data Loading & Preprocessing (dataloader.py + utils)
• Configuration Manager (configurator.py + CLI flags)
• Model Definition (model.py – Transformer encoder/decoder blocks)
• Training Engine (train.py / train_nano.py)
• Hyperparameter Tuner (rt.py)
• Evaluation & Testing (predict.py)
• Artifacts Store (models/ directory; logs for TensorBoard; history CSVs)
• Visualization & Reporting (utils/plotting.py)
b. Relationships & Data Flow
1. User invokes CLI (tune/train/predict) → passes through configurator → args
2. Configurator selects dataset files → Data Loader reads .npy/.csv → Tensor batches
3. Batches → Training Engine ↔ Model Definition ↔ Optimization utils
4. Training Engine writes:
– Model weights → models/<name>/weights*.hdf5
– Logs → models/<name>/model_history_log.csv and TensorBoard logs
5. Hyperparameter Tuner uses the same pipeline but additionally logs parameter combinations and metrics.
6. Prediction CLI loads model weights + Data Loader → outputs predictions (‘y_pred’) to TSV.
7. Plotting utilities can be used after the fact to generate figures from logs or output.txt.
c. Architectural patterns & principles
– Modular separation: CLI layer, config layer, data layer, model layer, utils layer
– File-based pipeline: disk is both the source and sink for data & artifacts
– Single-process, script-driven orchestration, no network or service layer
d. Key technologies & libraries
– Python 3.10, PyTorch (model training/inference), NumPy (data I/O), Pandas or CSV reader for .csv, h5py (HDF5 weights), TensorBoard (optional), matplotlib/seaborn (plotting).
Essential details to capture
• Exact filenames/directories where data and artifacts live (e.g., data/, models/).
• The fact that tuning (rt.py) and training share most of the pipeline but differ in control flow.
• The CLI-driven nature: scripts at top level invoke the pipeline.
• Use of PyTorch as the runtime engine and .hdf5 for weight storage.