================
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/black
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:
- `pytorch <https://pytorch.org>`_
- `pytorch-datastream <https://github.com/nextml-code/pytorch-datastream>`_
- `guild <https://guild.ai>`_
Usage
=====
Example of tensor type hinting.
.. code-block:: python
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 <https://pytorch-lantern.readthedocs.io/en/latest/>`_
for more information and usage examples.
Create new project with template
================================
Install `cookiecutter <https://github.com/cookiecutter/cookiecutter>`_
and `poetry <https://github.com/python-poetry/poetry>`_:
.. code-block::
pip install cookiecutter
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
Setup project:
.. code-block::
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:
.. code-block::
guild run prepare
guild run train
guild tensorboard
Use 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]
Raw data
{
"_id": null,
"home_page": "https://github.com/nextml-code/pytorch-lantern",
"name": "pytorch-lantern",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": "pytorch, machine, learning",
"author": "NextML AB",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/77/35/55483ac76b67bb00c85708efb687b624537927e310b3fb7efef4f5d45aa5/pytorch_lantern-0.12.13.tar.gz",
"platform": null,
"description": "================\nPytorch Lantern\n================\n\n.. image:: https://badge.fury.io/py/pytorch-lantern.svg\n :target: https://badge.fury.io/py/pytorch-lantern\n\n.. image:: https://img.shields.io/pypi/pyversions/pytorch-lantern.svg\n :target: https://pypi.python.org/pypi/pytorch-lantern\n\n.. image:: https://readthedocs.org/projects/pytorch-lantern/badge/?version=latest\n :target: https://pytorch-lantern.readthedocs.io/en/latest/?badge=latest\n\n.. image:: https://img.shields.io/pypi/l/pytorch-lantern.svg\n :target: https://pypi.python.org/pypi/pytorch-lantern\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n :target: https://github.com/psf/black\n\nLantern contains our process of bringing a project to fruition as\nefficiently as possible. This is subject to change as we iterate and improve.\nThis package implements tools and missing features to help bridge the gap\nbetween frameworks and libraries that we utilize.\n\nThe main packages and tools that we build around are:\n\n- `pytorch <https://pytorch.org>`_\n- `pytorch-datastream <https://github.com/nextml-code/pytorch-datastream>`_\n- `guild <https://guild.ai>`_\n\nUsage\n=====\n\nExample of tensor type hinting.\n\n.. code-block:: python\n\n from pydantic import BaseModel\n from typing import Annotated\n import torch\n from lantern import Tensor\n\n class Example(BaseModel):\n image: Annotated[torch.Tensor, Tensor.dims(\"NCHW\").float()]\n label: Annotated[torch.Tensor, Tensor.dims(\"N\").long()]\n\n example = Example(\n image=torch.rand(32, 3, 224, 224), # 32 images, 3 channels, 224x224 pixels\n label=torch.randint(0, 10, (32,)) # 32 labels\n )\n\nSee the `documentation <https://pytorch-lantern.readthedocs.io/en/latest/>`_\nfor more information and usage examples.\n\nCreate new project with template\n================================\n\nInstall `cookiecutter <https://github.com/cookiecutter/cookiecutter>`_\nand `poetry <https://github.com/python-poetry/poetry>`_:\n\n.. code-block::\n\n pip install cookiecutter\n curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python\n\nSetup project:\n\n.. code-block::\n\n cookiecutter https://github.com/nextml-code/pytorch-lantern-template.git\n cd <new-project>\n poetry install\n\nYou can now train the placeholder model and inspect the results:\n\n.. code-block::\n\n guild run prepare\n guild run train\n guild tensorboard\n\nUse lantern without templates\n==============================\n\nInstall lantern from pypi using pip or poetry:\n\n.. code-block::\n\n poetry add pytorch-lantern[training]\n\n.. code-block::\n\n pip install pytorch-lantern[training]\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Pytorch project template and related tools",
"version": "0.12.13",
"project_urls": {
"Documentation": "https://pytorch-lantern.readthedocs.io",
"Homepage": "https://github.com/nextml-code/pytorch-lantern",
"Repository": "https://github.com/nextml-code/pytorch-lantern"
},
"split_keywords": [
"pytorch",
" machine",
" learning"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e7fde2e9e15a9b3003e62f17cc3d5abddc56b548f50aac7bfff56cdb19ff59ff",
"md5": "c444d79e3ee57de6815aa0d99e3e8154",
"sha256": "2b2a496a3325953e36981a6ddd2a15039742213d8df11877408969b91b0ca32d"
},
"downloads": -1,
"filename": "pytorch_lantern-0.12.13-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c444d79e3ee57de6815aa0d99e3e8154",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 19593,
"upload_time": "2024-12-10T15:43:12",
"upload_time_iso_8601": "2024-12-10T15:43:12.285261Z",
"url": "https://files.pythonhosted.org/packages/e7/fd/e2e9e15a9b3003e62f17cc3d5abddc56b548f50aac7bfff56cdb19ff59ff/pytorch_lantern-0.12.13-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "773555483ac76b67bb00c85708efb687b624537927e310b3fb7efef4f5d45aa5",
"md5": "148a1b76ead313ab3b83726d557ef085",
"sha256": "691b48bfb7f6e66deab66edbbd1404ca11b2f0949f6d370a6e26298690a9d356"
},
"downloads": -1,
"filename": "pytorch_lantern-0.12.13.tar.gz",
"has_sig": false,
"md5_digest": "148a1b76ead313ab3b83726d557ef085",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 15955,
"upload_time": "2024-12-10T15:43:13",
"upload_time_iso_8601": "2024-12-10T15:43:13.302132Z",
"url": "https://files.pythonhosted.org/packages/77/35/55483ac76b67bb00c85708efb687b624537927e310b3fb7efef4f5d45aa5/pytorch_lantern-0.12.13.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-10 15:43:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "nextml-code",
"github_project": "pytorch-lantern",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pytorch-lantern"
}