You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Effortless Model Management for Your Development ⚡
2
2
3
-
This package provides utilities for saving and loading machine learning models using PyTorch Lightning. It aims to simplify the process of managing model checkpoints, making it easier to save, load, and share models.
3
+
__Effortless management for your ML models.__
4
4
5
-
## Features
5
+
<divalign="center">
6
6
7
-
-**Save Models**: Easily save your trained models to cloud storage.
8
-
-**Load Models**: Load pre-trained models for inference or further training.
9
-
-**Checkpoint Management**: Manage multiple checkpoints with ease.
10
-
-**Cloud Integration**: Support for saving and loading models from cloud storage services.
**Lightning Models** is a streamlined toolkit for effortlessly saving, loading, and managing your model checkpoints. Designed to simplify the entire model lifecycle—from training and inference to sharing, deployment, and cloud integration—Lightning Models supports any framework that produces model checkpoints, including but not limited to PyTorch Lightning.
17
16
18
-
To install the package, you can use `pip`:
17
+
<pre>
18
+
✅ Seamless Model Saving & Loading
19
+
✅ Robust Checkpoint Management
20
+
✅ Cloud Integration Out of the Box
21
+
✅ Versatile Across Frameworks
22
+
</pre>
23
+
24
+
# Quick start
25
+
26
+
Install Lightning Models via pip (more installation options below):
Lightning Models offers a simple API to manage your model checkpoints.
41
+
Train your model using your preferred framework (our fist examples show `scikit-learn`) and then save your best checkpoint with a single function call.
42
+
43
+
### Train scikit-learn model and save it
44
+
45
+
```python
46
+
import joblib
47
+
from sklearn import datasets, model_selection, svm
48
+
from litmodels import upload_model
49
+
50
+
# Unique model identifier: <organization>/<teamspace>/<model-name>
model = joblib.load(os.path.join("my_models", model_path[0]))
85
+
86
+
# Example: run inference with the loaded model
87
+
sample_input = [[5.1, 3.5, 1.4, 0.2]]
88
+
prediction = model.predict(sample_input)
89
+
print(f"Prediction: {prediction}")
90
+
```
91
+
92
+
## Saving and Loading Models with Pytorch Lightning
31
93
32
-
Here's a simple example of how to save and load a model using `litmodels`. First, you need to train a model using PyTorch Lightning. Then, you can save the model using the `upload_model` function.
94
+
Next examples demonstrate seamless PyTorch Lightning integration with Lightning Models.
95
+
96
+
### Train a simple Lightning model and save it
33
97
34
98
```python
35
99
from lightning import Trainer
36
-
from lightning.pytorch.callbacks import ModelCheckpoint
You can also enhance your training with a simple Checkpointing callback which would always save the best model to the cloud storage and continue training.
91
-
This can would be handy especially with long trainings or using interruptible machines so you would always resume/recover from the best model.
0 commit comments