pytorch-kito 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. pytorch_kito-0.1.0/LICENSE +21 -0
  2. pytorch_kito-0.1.0/PKG-INFO +317 -0
  3. pytorch_kito-0.1.0/README.md +254 -0
  4. pytorch_kito-0.1.0/pyproject.toml +71 -0
  5. pytorch_kito-0.1.0/setup.cfg +4 -0
  6. pytorch_kito-0.1.0/src/kito/__init__.py +49 -0
  7. pytorch_kito-0.1.0/src/kito/callbacks/__init__.py +20 -0
  8. pytorch_kito-0.1.0/src/kito/callbacks/callback_base.py +107 -0
  9. pytorch_kito-0.1.0/src/kito/callbacks/csv_logger.py +66 -0
  10. pytorch_kito-0.1.0/src/kito/callbacks/ddp_aware_callback.py +60 -0
  11. pytorch_kito-0.1.0/src/kito/callbacks/early_stopping_callback.py +45 -0
  12. pytorch_kito-0.1.0/src/kito/callbacks/modelcheckpoint.py +78 -0
  13. pytorch_kito-0.1.0/src/kito/callbacks/tensorboard_callback_images.py +298 -0
  14. pytorch_kito-0.1.0/src/kito/callbacks/tensorboard_callbacks.py +132 -0
  15. pytorch_kito-0.1.0/src/kito/callbacks/txt_logger.py +57 -0
  16. pytorch_kito-0.1.0/src/kito/config/__init__.py +0 -0
  17. pytorch_kito-0.1.0/src/kito/config/moduleconfig.py +149 -0
  18. pytorch_kito-0.1.0/src/kito/data/__init__.py +35 -0
  19. pytorch_kito-0.1.0/src/kito/data/datapipeline.py +273 -0
  20. pytorch_kito-0.1.0/src/kito/data/datasets.py +166 -0
  21. pytorch_kito-0.1.0/src/kito/data/preprocessed_dataset.py +57 -0
  22. pytorch_kito-0.1.0/src/kito/data/preprocessing.py +318 -0
  23. pytorch_kito-0.1.0/src/kito/data/registry.py +96 -0
  24. pytorch_kito-0.1.0/src/kito/engine.py +716 -0
  25. pytorch_kito-0.1.0/src/kito/module.py +436 -0
  26. pytorch_kito-0.1.0/src/kito/strategies/__init__.py +0 -0
  27. pytorch_kito-0.1.0/src/kito/strategies/logger_strategy.py +51 -0
  28. pytorch_kito-0.1.0/src/kito/strategies/progress_bar_strategy.py +57 -0
  29. pytorch_kito-0.1.0/src/kito/strategies/readiness_validator.py +85 -0
  30. pytorch_kito-0.1.0/src/kito/utils/__init__.py +0 -0
  31. pytorch_kito-0.1.0/src/kito/utils/gpu_utils.py +23 -0
  32. pytorch_kito-0.1.0/src/kito/utils/loss_utils.py +38 -0
  33. pytorch_kito-0.1.0/src/kito/utils/ssim_utils.py +94 -0
  34. pytorch_kito-0.1.0/src/pytorch_kito.egg-info/PKG-INFO +317 -0
  35. pytorch_kito-0.1.0/src/pytorch_kito.egg-info/SOURCES.txt +36 -0
  36. pytorch_kito-0.1.0/src/pytorch_kito.egg-info/dependency_links.txt +1 -0
  37. pytorch_kito-0.1.0/src/pytorch_kito.egg-info/requires.txt +31 -0
  38. pytorch_kito-0.1.0/src/pytorch_kito.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Giuseppe Costantino
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,317 @@
1
+ Metadata-Version: 2.4
2
+ Name: pytorch-kito
3
+ Version: 0.1.0
4
+ Summary: Effortless PyTorch training - define your model, Kito handles the rest
5
+ Author-email: Giuseppe Costantino <giuseppe.costantino95@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Giuseppe Costantino
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+ Project-URL: Homepage, https://github.com/gcostantino/kito
28
+ Project-URL: Documentation, https://kito.readthedocs.io
29
+ Project-URL: Repository, https://github.com/gcostantino/kito
30
+ Project-URL: Bug Tracker, https://github.com/gcostantino/kito/issues
31
+ Keywords: pytorch,deep-learning,machine-learning,training,automation
32
+ Requires-Python: >=3.9
33
+ Description-Content-Type: text/markdown
34
+ License-File: LICENSE
35
+ Requires-Dist: torch>=2.0.0
36
+ Requires-Dist: numpy>=1.20.0
37
+ Requires-Dist: h5py>=3.0.0
38
+ Requires-Dist: torchsummary>=1.5.1
39
+ Requires-Dist: packaging>=20.0
40
+ Requires-Dist: tensorboard>=2.10.0
41
+ Requires-Dist: pkbar>=0.5
42
+ Provides-Extra: dev
43
+ Requires-Dist: pytest>=7.0; extra == "dev"
44
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
45
+ Requires-Dist: pytest-mock>=3.10; extra == "dev"
46
+ Requires-Dist: black>=23.0; extra == "dev"
47
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
48
+ Provides-Extra: tensorboard
49
+ Requires-Dist: tensorboard>=2.10.0; extra == "tensorboard"
50
+ Provides-Extra: docs
51
+ Requires-Dist: sphinx>=5.0; extra == "docs"
52
+ Requires-Dist: sphinx-rtd-theme>=1.0; extra == "docs"
53
+ Provides-Extra: all
54
+ Requires-Dist: tensorboard>=2.10.0; extra == "all"
55
+ Requires-Dist: pytest>=7.0; extra == "all"
56
+ Requires-Dist: pytest-cov>=4.0; extra == "all"
57
+ Requires-Dist: pytest-mock>=3.10; extra == "all"
58
+ Requires-Dist: black>=23.0; extra == "all"
59
+ Requires-Dist: ruff>=0.1.0; extra == "all"
60
+ Requires-Dist: sphinx>=5.0; extra == "all"
61
+ Requires-Dist: sphinx-rtd-theme>=1.0; extra == "all"
62
+ Dynamic: license-file
63
+
64
+ # Kito
65
+
66
+ **Effortless PyTorch training - define your model, Kito handles the rest.**
67
+
68
+ [![Tests](https://github.com/gcostantino/kito/actions/workflows/tests.yml/badge.svg)](https://github.com/gcostantino/kito/actions)
69
+ [![PyPI version](https://badge.fury.io/py/pytorch-kito.svg)](https://badge.fury.io/py/pytorch-kito)
70
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
71
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
72
+
73
+ Kito is a lightweight PyTorch training library that eliminates boilerplate code. Define your model architecture and loss function - Kito automatically handles training loops, optimization, callbacks, distributed training, and more.
74
+
75
+ ## ✨ Key Features
76
+
77
+ - **Zero Boilerplate** - No training loops, no optimizer setup, no device management
78
+ - **Auto-Everything** - Automatic model building, optimizer binding, and device assignment
79
+ - **Built-in DDP** - Distributed training works out of the box
80
+ - **Smart Callbacks** - TensorBoard, checkpointing, logging, and custom callbacks
81
+ - **Flexible** - Simple for beginners, powerful for experts
82
+ - **Lightweight** - Minimal dependencies, pure PyTorch under the hood
83
+
84
+ ## Quick Start
85
+
86
+ ### Installation
87
+
88
+ ```bash
89
+ pip install pytorch-kito
90
+ ```
91
+
92
+ ### Your First Model in 3 Steps
93
+
94
+ ```python
95
+ import torch.nn as nn
96
+ from kito import Engine, KitoModule
97
+
98
+ # 1. Define your model
99
+ class MyModel(KitoModule):
100
+ def build_inner_model(self):
101
+ self.model = nn.Sequential(
102
+ nn.Linear(784, 128),
103
+ nn.ReLU(),
104
+ nn.Linear(128, 10)
105
+ )
106
+ self.model_input_size = (784,)
107
+
108
+ def bind_optimizer(self):
109
+ self.optimizer = torch.optim.Adam(
110
+ self.model.parameters(),
111
+ lr=self.learning_rate
112
+ )
113
+
114
+ # 2. Initialize
115
+ model = MyModel('MyModel', device, config)
116
+ engine = Engine(model, config)
117
+
118
+ # 3. Train! (That's it - everything else is automatic)
119
+ engine.fit(train_loader, val_loader, max_epochs=10)
120
+ ```
121
+
122
+ ## Philosophy
123
+
124
+ Kito follows a **"define once, train anywhere"** philosophy:
125
+
126
+ 1. **You focus on**: Model architecture and research ideas
127
+ 2. **Kito handles**: Training loops, optimization, distributed training, callbacks
128
+
129
+ Perfect for researchers who want to iterate quickly without rewriting training code.
130
+
131
+ ## Core Concepts
132
+
133
+ ### KitoModule
134
+
135
+ Your model inherits from `KitoModule` and implements two methods:
136
+
137
+ ```python
138
+ class MyModel(KitoModule):
139
+ def build_inner_model(self):
140
+ # Define your architecture
141
+ self.model = nn.Sequential(...)
142
+ self.model_input_size = (C, H, W) # Input shape
143
+
144
+ def bind_optimizer(self):
145
+ # Choose your optimizer
146
+ self.optimizer = torch.optim.Adam(
147
+ self.model.parameters(),
148
+ lr=self.learning_rate
149
+ )
150
+ ```
151
+
152
+ ### Engine
153
+
154
+ The `Engine` orchestrates everything:
155
+
156
+ ```python
157
+ engine = Engine(module, config)
158
+
159
+ # Training
160
+ engine.fit(train_loader, val_loader, max_epochs=100)
161
+
162
+ # Inference
163
+ predictions = engine.predict(test_loader)
164
+ ```
165
+
166
+ ### Data Pipeline
167
+
168
+ Kito provides a clean data pipeline with preprocessing:
169
+
170
+ ```python
171
+ from kito.data import H5Dataset, GenericDataPipeline
172
+ from kito.data.preprocessing import Pipeline, Normalize, ToTensor
173
+
174
+ # Create dataset
175
+ dataset = H5Dataset('data.h5')
176
+
177
+ # Add preprocessing
178
+ preprocessing = Pipeline([
179
+ Normalize(min_val=0.0, max_val=1.0),
180
+ ToTensor()
181
+ ])
182
+
183
+ # Setup data pipeline
184
+ pipeline = GenericDataPipeline(
185
+ config=config,
186
+ dataset=dataset,
187
+ preprocessing=preprocessing
188
+ )
189
+ pipeline.setup()
190
+
191
+ # Get dataloaders
192
+ train_loader = pipeline.train_dataloader()
193
+ val_loader = pipeline.val_dataloader()
194
+ ```
195
+
196
+ ### Callbacks
197
+
198
+ Kito includes powerful callbacks for common tasks:
199
+
200
+ ```python
201
+ from kito.callbacks import ModelCheckpoint, EarlyStopping, CSVLogger
202
+
203
+ callbacks = [
204
+ ModelCheckpoint('best_model.pt', monitor='val_loss', mode='min'),
205
+ EarlyStopping(patience=10, monitor='val_loss'),
206
+ CSVLogger('training.csv')
207
+ ]
208
+
209
+ engine.fit(train_loader, val_loader, callbacks=callbacks)
210
+ ```
211
+
212
+ Or create custom callbacks:
213
+
214
+ ```python
215
+ from kito.callbacks import Callback
216
+
217
+ class MyCallback(Callback):
218
+ def on_epoch_end(self, epoch, logs, **kwargs):
219
+ print(f"Epoch {epoch}: loss={logs['train_loss']:.4f}")
220
+ ```
221
+
222
+ ## Advanced Features
223
+
224
+ ### Distributed Training (DDP)
225
+
226
+ Enable distributed training with one config change:
227
+
228
+ ```python
229
+ config.training.distributed_training = True
230
+
231
+ # Everything else stays the same!
232
+ engine.fit(train_loader, val_loader, max_epochs=100)
233
+ ```
234
+
235
+ ### Custom Training Logic
236
+
237
+ Override `training_step` for custom behavior:
238
+
239
+ ```python
240
+ class MyModel(KitoModule):
241
+ def training_step(self, batch, pbar_handler=None):
242
+ inputs, targets = batch
243
+
244
+ # Custom forward pass
245
+ outputs = self.model(inputs)
246
+ loss = self.compute_loss((inputs, targets), outputs)
247
+
248
+ # Custom backward (e.g., gradient clipping)
249
+ self.optimizer.zero_grad()
250
+ loss.backward()
251
+ torch.nn.utils.clip_grad_norm_(self.model.parameters(), max_norm=1.0)
252
+ self.optimizer.step()
253
+
254
+ return {'loss': loss}
255
+ ```
256
+
257
+ ### Multiple Datasets
258
+
259
+ Kito supports HDF5 and in-memory datasets out of the box:
260
+
261
+ ```python
262
+ from kito.data import H5Dataset, MemDataset
263
+
264
+ # HDF5 dataset (lazy loading)
265
+ dataset = H5Dataset('large_data.h5')
266
+
267
+ # In-memory dataset (fast)
268
+ dataset = MemDataset(x_train, y_train)
269
+ ```
270
+
271
+ Register custom datasets easily:
272
+
273
+ ```python
274
+ from kito.data.registry import DATASETS
275
+
276
+ @DATASETS.register('my_custom_dataset')
277
+ class MyDataset(KitoDataset):
278
+ def _load_sample(self, index):
279
+ return data, labels
280
+ ```
281
+
282
+ ## 📦 Installation Options
283
+
284
+ ```bash
285
+ # Basic installation
286
+ pip install pytorch-kito
287
+
288
+ # With TensorBoard support
289
+ pip install pytorch-kito[tensorboard]
290
+
291
+ # Development installation
292
+ pip install pytorch-kito[dev]
293
+
294
+ # Everything
295
+ pip install pytorch-kito[all]
296
+ ```
297
+
298
+ ## 🤝 Contributing
299
+
300
+ Contributions are very welcome! Please check out our [Contributing Guide](CONTRIBUTING.md).
301
+
302
+ ## 📄 License
303
+
304
+ MIT License - see [LICENSE](LICENSE) file for details.
305
+
306
+ ## 🙏 Acknowledgments
307
+
308
+ Kito is inspired by PyTorch Lightning and Keras, aiming to bring similar ease-of-use to pure PyTorch workflows for researchers.
309
+
310
+ ## Contact
311
+
312
+ - **GitHub Issues**: [Report bugs or request features](https://github.com/gcostantino/kito/issues)
313
+ - **GitHub Discussions**: [Ask questions](https://github.com/gcostantino/kito/discussions)
314
+
315
+ ---
316
+
317
+ **Made with ❤️ for the PyTorch community**
@@ -0,0 +1,254 @@
1
+ # Kito
2
+
3
+ **Effortless PyTorch training - define your model, Kito handles the rest.**
4
+
5
+ [![Tests](https://github.com/gcostantino/kito/actions/workflows/tests.yml/badge.svg)](https://github.com/gcostantino/kito/actions)
6
+ [![PyPI version](https://badge.fury.io/py/pytorch-kito.svg)](https://badge.fury.io/py/pytorch-kito)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
9
+
10
+ Kito is a lightweight PyTorch training library that eliminates boilerplate code. Define your model architecture and loss function - Kito automatically handles training loops, optimization, callbacks, distributed training, and more.
11
+
12
+ ## ✨ Key Features
13
+
14
+ - **Zero Boilerplate** - No training loops, no optimizer setup, no device management
15
+ - **Auto-Everything** - Automatic model building, optimizer binding, and device assignment
16
+ - **Built-in DDP** - Distributed training works out of the box
17
+ - **Smart Callbacks** - TensorBoard, checkpointing, logging, and custom callbacks
18
+ - **Flexible** - Simple for beginners, powerful for experts
19
+ - **Lightweight** - Minimal dependencies, pure PyTorch under the hood
20
+
21
+ ## Quick Start
22
+
23
+ ### Installation
24
+
25
+ ```bash
26
+ pip install pytorch-kito
27
+ ```
28
+
29
+ ### Your First Model in 3 Steps
30
+
31
+ ```python
32
+ import torch.nn as nn
33
+ from kito import Engine, KitoModule
34
+
35
+ # 1. Define your model
36
+ class MyModel(KitoModule):
37
+ def build_inner_model(self):
38
+ self.model = nn.Sequential(
39
+ nn.Linear(784, 128),
40
+ nn.ReLU(),
41
+ nn.Linear(128, 10)
42
+ )
43
+ self.model_input_size = (784,)
44
+
45
+ def bind_optimizer(self):
46
+ self.optimizer = torch.optim.Adam(
47
+ self.model.parameters(),
48
+ lr=self.learning_rate
49
+ )
50
+
51
+ # 2. Initialize
52
+ model = MyModel('MyModel', device, config)
53
+ engine = Engine(model, config)
54
+
55
+ # 3. Train! (That's it - everything else is automatic)
56
+ engine.fit(train_loader, val_loader, max_epochs=10)
57
+ ```
58
+
59
+ ## Philosophy
60
+
61
+ Kito follows a **"define once, train anywhere"** philosophy:
62
+
63
+ 1. **You focus on**: Model architecture and research ideas
64
+ 2. **Kito handles**: Training loops, optimization, distributed training, callbacks
65
+
66
+ Perfect for researchers who want to iterate quickly without rewriting training code.
67
+
68
+ ## Core Concepts
69
+
70
+ ### KitoModule
71
+
72
+ Your model inherits from `KitoModule` and implements two methods:
73
+
74
+ ```python
75
+ class MyModel(KitoModule):
76
+ def build_inner_model(self):
77
+ # Define your architecture
78
+ self.model = nn.Sequential(...)
79
+ self.model_input_size = (C, H, W) # Input shape
80
+
81
+ def bind_optimizer(self):
82
+ # Choose your optimizer
83
+ self.optimizer = torch.optim.Adam(
84
+ self.model.parameters(),
85
+ lr=self.learning_rate
86
+ )
87
+ ```
88
+
89
+ ### Engine
90
+
91
+ The `Engine` orchestrates everything:
92
+
93
+ ```python
94
+ engine = Engine(module, config)
95
+
96
+ # Training
97
+ engine.fit(train_loader, val_loader, max_epochs=100)
98
+
99
+ # Inference
100
+ predictions = engine.predict(test_loader)
101
+ ```
102
+
103
+ ### Data Pipeline
104
+
105
+ Kito provides a clean data pipeline with preprocessing:
106
+
107
+ ```python
108
+ from kito.data import H5Dataset, GenericDataPipeline
109
+ from kito.data.preprocessing import Pipeline, Normalize, ToTensor
110
+
111
+ # Create dataset
112
+ dataset = H5Dataset('data.h5')
113
+
114
+ # Add preprocessing
115
+ preprocessing = Pipeline([
116
+ Normalize(min_val=0.0, max_val=1.0),
117
+ ToTensor()
118
+ ])
119
+
120
+ # Setup data pipeline
121
+ pipeline = GenericDataPipeline(
122
+ config=config,
123
+ dataset=dataset,
124
+ preprocessing=preprocessing
125
+ )
126
+ pipeline.setup()
127
+
128
+ # Get dataloaders
129
+ train_loader = pipeline.train_dataloader()
130
+ val_loader = pipeline.val_dataloader()
131
+ ```
132
+
133
+ ### Callbacks
134
+
135
+ Kito includes powerful callbacks for common tasks:
136
+
137
+ ```python
138
+ from kito.callbacks import ModelCheckpoint, EarlyStopping, CSVLogger
139
+
140
+ callbacks = [
141
+ ModelCheckpoint('best_model.pt', monitor='val_loss', mode='min'),
142
+ EarlyStopping(patience=10, monitor='val_loss'),
143
+ CSVLogger('training.csv')
144
+ ]
145
+
146
+ engine.fit(train_loader, val_loader, callbacks=callbacks)
147
+ ```
148
+
149
+ Or create custom callbacks:
150
+
151
+ ```python
152
+ from kito.callbacks import Callback
153
+
154
+ class MyCallback(Callback):
155
+ def on_epoch_end(self, epoch, logs, **kwargs):
156
+ print(f"Epoch {epoch}: loss={logs['train_loss']:.4f}")
157
+ ```
158
+
159
+ ## Advanced Features
160
+
161
+ ### Distributed Training (DDP)
162
+
163
+ Enable distributed training with one config change:
164
+
165
+ ```python
166
+ config.training.distributed_training = True
167
+
168
+ # Everything else stays the same!
169
+ engine.fit(train_loader, val_loader, max_epochs=100)
170
+ ```
171
+
172
+ ### Custom Training Logic
173
+
174
+ Override `training_step` for custom behavior:
175
+
176
+ ```python
177
+ class MyModel(KitoModule):
178
+ def training_step(self, batch, pbar_handler=None):
179
+ inputs, targets = batch
180
+
181
+ # Custom forward pass
182
+ outputs = self.model(inputs)
183
+ loss = self.compute_loss((inputs, targets), outputs)
184
+
185
+ # Custom backward (e.g., gradient clipping)
186
+ self.optimizer.zero_grad()
187
+ loss.backward()
188
+ torch.nn.utils.clip_grad_norm_(self.model.parameters(), max_norm=1.0)
189
+ self.optimizer.step()
190
+
191
+ return {'loss': loss}
192
+ ```
193
+
194
+ ### Multiple Datasets
195
+
196
+ Kito supports HDF5 and in-memory datasets out of the box:
197
+
198
+ ```python
199
+ from kito.data import H5Dataset, MemDataset
200
+
201
+ # HDF5 dataset (lazy loading)
202
+ dataset = H5Dataset('large_data.h5')
203
+
204
+ # In-memory dataset (fast)
205
+ dataset = MemDataset(x_train, y_train)
206
+ ```
207
+
208
+ Register custom datasets easily:
209
+
210
+ ```python
211
+ from kito.data.registry import DATASETS
212
+
213
+ @DATASETS.register('my_custom_dataset')
214
+ class MyDataset(KitoDataset):
215
+ def _load_sample(self, index):
216
+ return data, labels
217
+ ```
218
+
219
+ ## 📦 Installation Options
220
+
221
+ ```bash
222
+ # Basic installation
223
+ pip install pytorch-kito
224
+
225
+ # With TensorBoard support
226
+ pip install pytorch-kito[tensorboard]
227
+
228
+ # Development installation
229
+ pip install pytorch-kito[dev]
230
+
231
+ # Everything
232
+ pip install pytorch-kito[all]
233
+ ```
234
+
235
+ ## 🤝 Contributing
236
+
237
+ Contributions are very welcome! Please check out our [Contributing Guide](CONTRIBUTING.md).
238
+
239
+ ## 📄 License
240
+
241
+ MIT License - see [LICENSE](LICENSE) file for details.
242
+
243
+ ## 🙏 Acknowledgments
244
+
245
+ Kito is inspired by PyTorch Lightning and Keras, aiming to bring similar ease-of-use to pure PyTorch workflows for researchers.
246
+
247
+ ## Contact
248
+
249
+ - **GitHub Issues**: [Report bugs or request features](https://github.com/gcostantino/kito/issues)
250
+ - **GitHub Discussions**: [Ask questions](https://github.com/gcostantino/kito/discussions)
251
+
252
+ ---
253
+
254
+ **Made with ❤️ for the PyTorch community**
@@ -0,0 +1,71 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "pytorch-kito"
7
+ dynamic = ["version"]
8
+ description = "Effortless PyTorch training - define your model, Kito handles the rest"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = {file = "LICENSE"}
12
+ authors = [
13
+ {name = "Giuseppe Costantino", email = "giuseppe.costantino95@gmail.com"}
14
+ ]
15
+ keywords = ["pytorch", "deep-learning", "machine-learning", "training", "automation"]
16
+ # Core dependencies (required for kito to work)
17
+ dependencies = [
18
+ "torch>=2.0.0",
19
+ "numpy>=1.20.0",
20
+ "h5py>=3.0.0",
21
+ "torchsummary>=1.5.1",
22
+ "packaging>=20.0",
23
+ "tensorboard>=2.10.0",
24
+ "pkbar>=0.5",
25
+ ]
26
+
27
+ # Optional dependencies
28
+ [project.optional-dependencies]
29
+ # Development and testing
30
+ dev = [
31
+ "pytest>=7.0",
32
+ "pytest-cov>=4.0",
33
+ "pytest-mock>=3.10",
34
+ "black>=23.0",
35
+ "ruff>=0.1.0",
36
+ ]
37
+
38
+ # TensorBoard support
39
+ tensorboard = [
40
+ "tensorboard>=2.10.0",
41
+ ]
42
+
43
+ # Documentation
44
+ docs = [
45
+ "sphinx>=5.0",
46
+ "sphinx-rtd-theme>=1.0",
47
+ ]
48
+
49
+ # All extras (convenience)
50
+ all = [
51
+ "tensorboard>=2.10.0",
52
+ "pytest>=7.0",
53
+ "pytest-cov>=4.0",
54
+ "pytest-mock>=3.10",
55
+ "black>=23.0",
56
+ "ruff>=0.1.0",
57
+ "sphinx>=5.0",
58
+ "sphinx-rtd-theme>=1.0",
59
+ ]
60
+
61
+ [project.urls]
62
+ Homepage = "https://github.com/gcostantino/kito"
63
+ Documentation = "https://kito.readthedocs.io"
64
+ Repository = "https://github.com/gcostantino/kito"
65
+ "Bug Tracker" = "https://github.com/gcostantino/kito/issues"
66
+
67
+ [tool.setuptools.packages.find]
68
+ where = ["src"]
69
+
70
+ [tool.setuptools.dynamic]
71
+ version = {attr = "kito.__version__"}
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+