Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nextml-code/pytorch-lantern
Lantern is a template and utilities for working with pytorch
https://github.com/nextml-code/pytorch-lantern
Last synced: 1 day ago
JSON representation
Lantern is a template and utilities for working with pytorch
- Host: GitHub
- URL: https://github.com/nextml-code/pytorch-lantern
- Owner: nextml-code
- License: apache-2.0
- Created: 2020-11-12T15:34:54.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-12-10T15:40:48.000Z (about 1 month ago)
- Last Synced: 2025-01-10T19:40:38.027Z (4 days ago)
- Language: Python
- Homepage:
- Size: 646 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
================
Pytorch Lantern
================.. image:: https://badge.fury.io/py/pytorch-lantern.svg
:target: https://badge.fury.io/py/pytorch-lantern.. image:: https://img.shields.io/pypi/pyversions/pytorch-lantern.svg
:target: https://pypi.python.org/pypi/pytorch-lantern.. image:: https://readthedocs.org/projects/pytorch-lantern/badge/?version=latest
:target: https://pytorch-lantern.readthedocs.io/en/latest/?badge=latest.. image:: https://img.shields.io/pypi/l/pytorch-lantern.svg
:target: https://pypi.python.org/pypi/pytorch-lantern.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/blackLantern 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:
- `pytorch `_
- `pytorch-datastream `_
- `guild `_Usage
=====Example of tensor type hinting.
.. code-block:: python
from pydantic import BaseModel
from typing import Annotated
import torch
from lantern import Tensorclass 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.Create new project with template
================================Install `cookiecutter `_
and `poetry `_:.. code-block::
pip install cookiecutter
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | pythonSetup project:
.. code-block::
cookiecutter https://github.com/nextml-code/pytorch-lantern-template.git
cd
poetry installYou can now train the placeholder model and inspect the results:
.. code-block::
guild run prepare
guild run train
guild tensorboardUse lantern without templates
==============================Install lantern from pypi using pip or poetry:
.. code-block::
poetry add pytorch-lantern[training]
.. code-block::
pip install pytorch-lantern[training]