A modular deep learning framework for supervised learning.
Project description
Easel
Easel is a modular, flexible, and scalable deep learning framework built on top of PyTorch and HuggingFace Accelerate. It organizes deep learning projects into three logically separate modules — Data, Model, and Engine — providing a clean structure without heavy boilerplate. Distributed training, mixed precision, gradient accumulation, and experiment tracking are all natively supported through Accelerate.
Installation
Pip users:
pip install easel
Uv users:
uv add easel
Requirements: Python 3.8+, PyTorch 2.0+, accelerate.
Tutorial
A supervised learning pipeline in Easel consists of three modules:
- Data — Handles dataset construction and dataloader creation.
- Model — Defines the network architecture and optimizer configuration.
- Engine — Orchestrates the training, validation, testing, and prediction loops.
Each module is independent: the Model knows nothing about training or validation logic, the Data knows nothing about the model, and the Engine ties them together. Let's build each one.
Data
Subclass Data and override setup to assign your datasets. Easel calls setup automatically and builds dataloaders from whatever datasets you assign.
import torch
from torch.utils.data import TensorDataset
from easel import Data
class MyData(Data):
def setup(self, stage=None):
x = torch.randn(1000, 10)
y = torch.randn(1000, 1)
ds = TensorDataset(x, y)
self.train_dataset = ds
self.val_dataset = ds
Model
Subclass Model and define your architecture in forward, plus your optimizer and optional LR scheduler in configure_optimizers. The Model contains no training or validation logic — it only defines the network and how to optimize it.
import torch.nn as nn
from easel import Model
class MyModel(Model):
def __init__(self):
super().__init__()
self.layer = nn.Linear(10, 1)
def forward(self, x):
return self.layer(x)
def configure_optimizers(self):
opt = torch.optim.Adam(self.parameters(), lr=1e-3)
sched = torch.optim.lr_scheduler.StepLR(opt, step_size=1)
return {"optimizer": opt, "lr_scheduler": sched}
Engine
Subclass Engine and implement train_step and val_step. These methods receive a batch and return a loss tensor (or a dict with a "loss" key). The Engine handles the rest — the training loop, gradient accumulation, optimizer steps, scheduler steps, and validation scheduling.
import torch.nn as nn
from easel import Engine
class MyEngine(Engine):
def train_step(self, batch):
x, y = batch
return nn.functional.mse_loss(self.model(x), y)
def val_step(self, batch):
x, y = batch
return {"val_loss": nn.functional.mse_loss(self.model(x), y)}
Putting it together
Pass your Data and Model to the Engine, configure the training parameters, and call run.
engine = MyEngine(
model=MyModel(),
data=MyData(),
train_batch_size=32,
max_epochs=10,
seed=42,
)
engine.run()
This trains the model with MSE loss, runs validation every epoch, and steps the LR scheduler automatically. To use your own data, override setup; to use your own architecture, override forward and configure_optimizers.
Features
- Modular design — Clean separation of logic across
Data,Model, andEngine. The Model defines only the network and optimizer, with no details about training or validation. The Data handles only dataset construction. The Engine orchestrates everything. - Accelerate integration — Distributed training (multi-GPU, multi-node), mixed precision (FP16, BF16, FP8), gradient accumulation, and experiment tracking (WandB, TensorBoard) all work out of the box with no extra code.
- Lifecycle hooks — Override
on_train_epoch_start,on_val_step_end, and 20+ other hooks to inject custom logic at any point in the training loop without modifying the loop itself.
License
Easel is released under the MIT License.
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 easel-0.0.2.tar.gz.
File metadata
- Download URL: easel-0.0.2.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eab54d157ca1b6bce05e9061cd0a6d14443cbb935db17010bec71f5b6a3584bb
|
|
| MD5 |
f43f7c9091efdd9de14297fc5ee2a3a9
|
|
| BLAKE2b-256 |
24fe5a57455ab5343107241cca853522636d07b0f4f38e72587cb977581cd022
|
File details
Details for the file easel-0.0.2-py3-none-any.whl.
File metadata
- Download URL: easel-0.0.2-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f242ae1b2b977a193dd256b0baff84b4b7835bc2f99b98523c583b27752957da
|
|
| MD5 |
931c9a8b709577b61b68c5f737ecc962
|
|
| BLAKE2b-256 |
cd724ef4a80214acd1fe761e13add62cf49b22000236986fc61d80d95d98c21a
|