SR-Forge
Structured Research Framework for Organized Research & Guided Experiments
SR-Forge is a modular, config-driven PyTorch framework for deep learning research. It handles the repetitive plumbing — data routing, component wiring, configuration management — so you can focus on what matters: your models, your data, and your experiments.
How It Works
Dataset --> [Entry] --> Transforms --> [Entry] --> Model --> [Entry] --> Metric
- A Dataset loads raw data and wraps it in an Entry — a dictionary-like container that carries tensors, metadata, and any other fields through the pipeline
- Transforms preprocess the data (normalize, augment, reshape)
- A Model runs the neural network computation
- Results are written back to the Entry
- A Metric evaluates the prediction against the target — as a training loss or as an evaluation score
Every component reads from and writes to Entry objects. This uniform interface is what makes everything interchangeable — swap any component and the rest of the pipeline doesn't change.
Key Features
- Entry-based data flow — All data lives in Entry objects. Every component reads from Entry fields and writes back to them, so components are interchangeable without glue code.
- IO binding — Components declare abstract port names ("I need an
image") that get mapped to concrete Entry fields ("read frominput_rgb"). Write a component once, reuse it with any data layout. - Pipeline composition — Chain models and transforms with a simple arrow syntax:
image -> encoder -> features -> decoder -> output. - Configuration over code — Define entire experiments in YAML. Reproduce any experiment by sharing a config file.
- Built-in models — FSRCNN, DSen2, RAMS, TR-MISR, MagNAt, plus a registry for custom architectures.
- Unified metrics — L1, L2, SSIM, LPIPS, schedulable loss combiners, and straightforward logging.
Installation
Prerequisites
Install PyTorch before installing SR-Forge. Follow the official instructions at pytorch.org to pick the right build for your OS and GPU.
# Example: CUDA 12.8
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128
# Example: CPU only
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
Install SR-Forge
pip install srforge
Graph neural network support (optional)
For graph-based models (e.g., MagNAt), install PyTorch Geometric first, then the graph extra:
pip install torch-geometric
pip install pyg-lib torch-scatter torch-sparse torch-cluster torch-spline-conv \
-f https://data.pyg.org/whl/torch-2.7.0+cu128.html
pip install srforge[graph]
Quick Start
mkdir my-experiment && cd my-experiment
srforge init
This generates a complete training script and config file:
my-experiment/
├── train.py # Complete training script
└── configs/
└── train-cfg.yaml # Sample config with all settings
Edit configs/train-cfg.yaml to point at your data, then run:
python train.py
The generated files are a starting point — modify them to fit your workflow. The config supports multi-GPU, mixed precision, dataset caching, W&B tracking, loss scheduling, and checkpointing out of the box.
A Taste of SR-Forge
from srforge.models import Model
from srforge.data import Entry
import torch
class Upscaler(Model):
def __init__(self):
super().__init__()
self.net = torch.nn.Conv2d(3, 3, 3, padding=1)
def _forward(self, image):
return self.net(image)
model = Upscaler()
model.set_io({"inputs": {"image": "input"}, "outputs": "prediction"})
entry = Entry({"input": torch.randn(1, 3, 64, 64)})
result = model(entry)
print(result.prediction.shape) # torch.Size([1, 3, 64, 64])
The model reads from entry["input"], runs the network, and stores the result in entry["prediction"].
Documentation
Full documentation is available at tarasiewicztomasz.gitlab.io/sr-forge.
For Developers
Install PyTorch and PyG with CUDA wheels first (see above), then clone and install in editable mode:
git clone https://gitlab.com/tarasiewicztomasz/sr-forge.git
cd sr-forge
pip install -e ".[dev,graph]"
Run the test suite:
pytest tests/ -v
Some tests require optional dependencies (e.g., torch_geometric). These are automatically skipped if the dependency is missing.
Contributing
SR-Forge is under active development. Contributions welcome!
- Report issues on GitLab
- Submit merge requests
- Share your models and experiments
Metadata
Release files for srforge 0.16.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| srforge-0.16.2.tar.gz | 842.2 kB | Without provenance | Details for srforge-0.16.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| srforge-0.16.2-py3-none-any.whl | Python 3 | none | any | Details for srforge-0.16.2-py3-none-any.whl |
Total release size: 1.2 MB
Release files / srforge-0.16.2.tar.gz
| Download URL | srforge-0.16.2.tar.gz |
|---|---|
| Size | 842.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dd4a921ef229315ee081dbaf55ba0a88144e3130436d24290894ac085fbaba4a
|
|
BLAKE2b-256 checksum How to use checksums |
8bbddaf2e7d4b5d49bec87c06a6a97df43be76e4ea790bc174a350d0ec6dbc3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Release files / srforge-0.16.2-py3-none-any.whl
| Download URL | srforge-0.16.2-py3-none-any.whl |
|---|---|
| Size | 377.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f119f71c913c2723ff9922faf7d1f71caef53c957a6f1a1873cdbdafd96eff9b
|
|
BLAKE2b-256 checksum How to use checksums |
32a0ec59b31d93805b66e656bfc6d8c158c82fab0f2d2b0f81c8321ad6aa29ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Security for srforge 0.16.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.