Deep Learning Toolkit — Reusable PyTorch building blocks for artificial intelligence & scientific machine learning: networks, losses, training loops, and utilities.
Project description
Deep Learning Toolkit
Reusable PyTorch building blocks for artificial intelligence & scientific machine learning: networks, losses, training loops, and utilities.
Installing the deep-learning-toolkit
Requirements
- Python
>=3.11
Runtime dependencies
prettytable>=3,<4pyyaml>=6,<7torch>=2,<3tqdm>=4,<5
Install in regular mode
pip install deep-learning-toolkit
Install the package in editable mode
When using a clone of the Git repository, run this command from inside the cloned directory:
pip install -e .
Install with optional extras
Dependencies for kernel density estimation:
pip install -e ".[kde]"
Dependencies for running tests:
pip install -e ".[test]"
Install with optional extras for development
pip install -e ".[dev]"
Using [dev] includes extras from [test].
Importing and using dlk
To use the toolkit, import its modules in your Python code like this:
from dlk.nets.mlp import MLPNet
from dlk.opt.train import train_epochs
# load your data
...
# create the model
net = MLPNet(input_size=784, output_size=10)
# train the model
train_epochs(n_epochs=100, net=net, dataloader=..., optimizer=..., loss_fn=...)
# evaluate
...
Architecture
Neural network architectures → dlk/nets/
mlp.py: Multilayer Perceptron (MLPNet, MLPNet_MultIn, MLPResNet with residual and attention blocks)autoencoder.py: Generic autoencoder wrapper for encoder/decoder pairsconv1d.py,conv2d.py: 1D/2D convolutional networks and UNet components (Downsample, Upsample)unet.py: Complete UNet implementations (older UNet1D/UNet2D and newer UNetXd_2025 architecture)transformer1d.py: 1D transformer networks with patch embeddings and multi-head attentionefficientnet.py: EfficientNet architecture
Network initialization
All network modules follow a consistent pattern:
- Constructor calls
self.init_parameters()at the end init_parameters()uses Xavier initialization with gain calculated from activation functions- Utility functions
_get_gain()and_set_init_parameters()handle activation-aware initialization
Training and optimization → dlk/opt/
train.py: Training loops (train_epochs,train_batches) with checkpointing and validation hookstrain_gan.py: GAN-specific training loopsscheduler.py: Learning rate schedulers (multi-stage: linear warmup, constant, cosine annealing)
Logging of the training progress
Training functions return detailed logging dictionaries (dlog) containing:
- Per-epoch loss statistics (
loss_mean,loss_std) - Batch-level logs nested in
batch_dlog - Total training time in
time_train - Checkpointing saves model and optimizer states at specified intervals
Additional components of the package
dlk/mgmt/: Management of configuration parameter loading/saving, logging, etc.dlk/loss/: Loss functionsdlk/metrics/: Metrics for evaluating trained nets
Development
Commands for development
make format: runisortandblackondlk/andtests/make format-check: checkisortandblackformatting without modifying filesmake compile: runpython -m compileall -q -fondlk/andtests/make lint: runbasedpyrightondlk/andtests/make test: runpytest(aftermake compile)make testq: runpytest -q(aftermake compile)make testv: runpytest -v(aftermake compile)make testvv: runpytest -sv(aftermake compile)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file deep_learning_toolkit-0.4.0.tar.gz.
File metadata
- Download URL: deep_learning_toolkit-0.4.0.tar.gz
- Upload date:
- Size: 78.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49b8b646ae511838c9e825109f3f504d0d51e0b58c92bb123bf5796f3de0bc49
|
|
| MD5 |
110c6227239d3e3faae07eebf8fe64cf
|
|
| BLAKE2b-256 |
c3d80be5b2731ce1f452765f5c12dffc2f1628d92ad81ecb400643e8661ddbb3
|
Provenance
The following attestation bundles were made for deep_learning_toolkit-0.4.0.tar.gz:
Publisher:
publish.yml on johannrudi/deep-learning-toolkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deep_learning_toolkit-0.4.0.tar.gz -
Subject digest:
49b8b646ae511838c9e825109f3f504d0d51e0b58c92bb123bf5796f3de0bc49 - Sigstore transparency entry: 1650427390
- Sigstore integration time:
-
Permalink:
johannrudi/deep-learning-toolkit@c3eb85b4c6480fdc04cccf9e748ba7e743bac0ff -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/johannrudi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c3eb85b4c6480fdc04cccf9e748ba7e743bac0ff -
Trigger Event:
push
-
Statement type:
File details
Details for the file deep_learning_toolkit-0.4.0-py3-none-any.whl.
File metadata
- Download URL: deep_learning_toolkit-0.4.0-py3-none-any.whl
- Upload date:
- Size: 92.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3bb655160dd4fd64060cb33a9d09a36a7290b2cd31a936099eacb0119210acd
|
|
| MD5 |
7f337df245d8e6b7e76d99c47bb6cc02
|
|
| BLAKE2b-256 |
0f5d6a1600f4f0c51cbb274a2930f3ca314bbd9ee3509c0b4021eca6d287a6ec
|
Provenance
The following attestation bundles were made for deep_learning_toolkit-0.4.0-py3-none-any.whl:
Publisher:
publish.yml on johannrudi/deep-learning-toolkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
deep_learning_toolkit-0.4.0-py3-none-any.whl -
Subject digest:
f3bb655160dd4fd64060cb33a9d09a36a7290b2cd31a936099eacb0119210acd - Sigstore transparency entry: 1650427416
- Sigstore integration time:
-
Permalink:
johannrudi/deep-learning-toolkit@c3eb85b4c6480fdc04cccf9e748ba7e743bac0ff -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/johannrudi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c3eb85b4c6480fdc04cccf9e748ba7e743bac0ff -
Trigger Event:
push
-
Statement type: