Lantern contains our process of bringing a project to fruition as efficiently as possible. This is subject to change as we iterate and improve. This package implements tools and missing features to help bridge the gap between frameworks and libraries that we utilize.
The main packages and tools that we build around are:
Example of tensor type hinting.
from pydantic import BaseModel
from typing import Annotated
import torch
from lantern import Tensor
class Example(BaseModel):
image: Annotated[torch.Tensor, Tensor.dims("NCHW").float()]
label: Annotated[torch.Tensor, Tensor.dims("N").long()]
example = Example(
image=torch.rand(32, 3, 224, 224), # 32 images, 3 channels, 224x224 pixels
label=torch.randint(0, 10, (32,)) # 32 labels
)
See the documentation for more information and usage examples.
Install cookiecutter and poetry:
pip install cookiecutter curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
Setup project:
cookiecutter https://github.com/nextml-code/pytorch-lantern-template.git cd <new-project> poetry install
You can now train the placeholder model and inspect the results:
guild run prepare guild run train guild tensorboard
Install lantern from pypi using pip or poetry:
poetry add pytorch-lantern[training]
pip install pytorch-lantern[training]