PADL
Pipeline Abstractions for Deep Learning
Full documentation here: https://lf1-io.github.io/padl/
Just as programs are read more often than they are written, so are deep learning models used more often than they are trained.
The PyTorch ecosystem has many tools for training models. However, this is only the beginning of the journey. Once a model has been trained, it will be shared, and used in a multitude of contexts, often on a daily basis, in operations, evaluation, comparision and experimentation by data scientists. The use of the trained model, is how value is extracted out of its weights. Despite this important fact, support for using deep-learning models up to now has been very thin in the PyTorch ecosystem and beyond. PADL is a tool which fills this void.
PADL
Is great for:
- serving model predictions
- experimentation with pre-trained models in Jupyter notebooks and interactive sessions
- inspecting and visualizing intermediate model features
- evaluating and monitoring model performance on metrics and incoming test data
- computing model outputs as a preprocessing step for further data science tasks
This is how it works:
- PADL is a pipeline builder for PyTorch.
- may be used with all of the great PyTorch functionality you're used to for writing layers.
- allows users to build pre-processing, forward passes, loss functions and post-processing into the pipeline.
- models may have arbitrary topologies and make use of arbitrary packages from the python ecosystem.
- allows for converting standard functions to PADL components using a single keyword
transform.
PADL pipelines:
- can be trained with minimal boilerplate in PyTorch Lightning
- can then be served in one line with TorchServe
- interact well with the entire PyTorch ecosystem (for example Hugging Face)
PADL was developed at LF1, an AI innovation lab based in Berlin, Germany.
Getting Started
Installation
pip install padl
PADL currently supports python 3.7, 3.8 and 3.9.
Python version >= 3.8 is preferred because creating and loading transforms (not execution) can be slower in 3.7.
WARNING: PADL transforms do not work in the base Python Interpreter environment because we rely on the inspect module to find source code (used when saving PADL transforms). Unfortunately, the source code typed at this interactive prompt is discarded as soon as it is parsed. Therefore, we recommend using the IPython interpreter or Jupyter Notebooks for interactive sessions.
Your first PADL program
from padl import transform, batch, unbatch
import torch
from torch import nn
nn = transform(nn)
@transform
def prepare(x):
return torch.tensor(x)
@transform
def post(x):
return x.topk(1)[1].item()
my_pipeline = prepare >> batch >> nn.Linear(10, 20) >> unbatch >> post
Try out PADL in Colab notebooks
- Basic PADL
- MNIST
- Simple NLP example
- Sentiment Analysis - NLP
- DC-GAN - Image Generation
- CLIP guided diffusion for face editing
Resources
- Read the documentation at https://lf1-io.github.io/padl/.
- Find examples at https://github.com/lf1-io/padl/tree/main/notebooks.
- Post issues at https://github.com/lf1-io/padl/issues.
Dev Blog
Read more about PADL on the PADL developer's blog
Contributing
If you're interested in contributing to PADL please look at the current issues
Licensing
PADL is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.
Metadata
Release files for padl 0.2.6
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 |
|---|---|---|---|---|
| padl-0.2.6.tar.gz | 145.0 kB | Without provenance | Details for padl-0.2.6.tar.gz |
Release files / padl-0.2.6.tar.gz
| Download URL | padl-0.2.6.tar.gz |
|---|---|
| Size | 145.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
186628e767aa6aa27bbac41829e41da4da9477a3e0068af069c63724323457c0
|
|
BLAKE2b-256 checksum How to use checksums |
d2e59dceb2fe4074af3f4dd70a91dd07ec72158d324cd8e6b82ea7c05c983659
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.2
|
Security for padl 0.2.6
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.