{"id":20261315,"url":"https://github.com/lightning-ai/tutorials","last_synced_at":"2025-05-16T00:06:22.167Z","repository":{"id":37088422,"uuid":"344856397","full_name":"Lightning-AI/tutorials","owner":"Lightning-AI","description":"Collection of Pytorch lightning tutorial form as rich scripts automatically transformed to ipython notebooks.","archived":false,"fork":false,"pushed_at":"2025-05-01T10:24:49.000Z","size":18488,"stargazers_count":313,"open_issues_count":15,"forks_count":80,"subscribers_count":20,"default_branch":"main","last_synced_at":"2025-05-01T10:25:59.821Z","etag":null,"topics":["deep-learning","jupyter-notebook","lightning","machine-learning","notebooks","python-scripts","tutorials"],"latest_commit_sha":null,"homepage":"https://lightning-ai.github.io/tutorials","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Lightning-AI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-03-05T15:43:11.000Z","updated_at":"2025-05-01T10:18:48.000Z","dependencies_parsed_at":"2023-02-17T03:30:45.044Z","dependency_job_id":"1e042d9a-2fbd-4fcd-84d2-e7176b65f0a1","html_url":"https://github.com/Lightning-AI/tutorials","commit_stats":{"total_commits":350,"total_committers":28,"mean_commits":12.5,"dds":0.7,"last_synced_commit":"3b8f0b613efc3771ba67f46dc9ab9d2a36c38fa7"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lightning-AI%2Ftutorials","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lightning-AI%2Ftutorials/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lightning-AI%2Ftutorials/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lightning-AI%2Ftutorials/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lightning-AI","download_url":"https://codeload.github.com/Lightning-AI/tutorials/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254442854,"owners_count":22071878,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","jupyter-notebook","lightning","machine-learning","notebooks","python-scripts","tutorials"],"created_at":"2024-11-14T11:25:13.536Z","updated_at":"2025-05-16T00:06:22.119Z","avatar_url":"https://github.com/Lightning-AI.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PytorchLightning Tutorials\n\n[![CI internal](https://github.com/Lightning-AI/tutorials/actions/workflows/ci_internal.yml/badge.svg?event=push)](https://github.com/Lightning-AI/tutorials/actions/workflows/ci_internal.yml)\n[![Build Status](https://dev.azure.com/Lightning-AI/Tutorials/_apis/build/status/Lightning-AI.tutorials%20%5Bpublish%5D?branchName=main)](https://dev.azure.com/Lightning-AI/Tutorials/_build/latest?definitionId=29\u0026branchName=main)\n[![codecov](https://codecov.io/gh/Lightning-AI/tutorials/branch/main/graph/badge.svg?token=C6T3XOOR56)](https://codecov.io/gh/Lightning-AI/tutorials)\n[![Deploy Docs](https://github.com/Lightning-AI/tutorials/actions/workflows/docs-deploy.yml/badge.svg)](https://github.com/Lightning-AI/tutorials/actions/workflows/docs-deploy.yml)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/Lightning-AI/tutorials/main.svg)](https://results.pre-commit.ci/latest/github/Lightning-AI/tutorials/main)\n\nThis is the Lightning Library - collection of Lightning related notebooks which are pulled back to the main repo as submodule and rendered inside the main documentations.\nThe key features/highlights:\n\n- we keep the repo **light-weighted** - notebooks are stored in rich script format\n- all scripts/notebooks are tested to be **fully executable**\n- fully **reproducible** by saving runtime env. details\n\nFor more details read our blogpost - [Best Practices for Publishing PyTorch Lightning Tutorial Notebooks](https://devblog.pytorchlightning.ai/publishing-lightning-tutorials-cbea3eaa4b2c)\n\n## Adding/Editing notebooks\n\nThis repo in main branch contain only python scripts with markdown extensions, and notebooks are generated in special publication branch, so no raw notebooks are accepted as PR.\nOn the other hand we highly recommend creating a notebooks and convert it script with [jupytext](https://jupytext.readthedocs.io/en/latest/) as\n\n```bash\njupytext --set-formats ipynb,py:percent my-notebook.ipynb\n```\n\n## Contribution structure\n\nThe addition has to formed as new folder:\n\n- the folder name is used for the future notebook\n- single python scripts or converted notebook to `.py` file (name does not matter)\n- metadata named `.meta.yaml` including following info:\n  ```yaml\n  title: Sample notebooks\n  author: [User](contact)\n  created: YYYY-MM-DD\n  updated: YYYY-MM-DD\n  license: CC BY-SA\n  # multi-line\n  description: |\n    This notebook will walk you through ...\n  # define supported - CPU|GPU|TPU\n  accelerator:\n    - CPU\n  ```\n- _[optional]_ requirements listed in `requirements.txt` in the particular folder (in case you need some other packaged then listed the parent folder)\n\n## Using datasets\n\nIt is quite common to use some public or competition's dataset for your example.\nWe facilitate this via defining the data sources in the metafile.\nThere are two basic options, download a file from web or pul Kaggle dataset _[Experimental]_:\n\n```yaml\ndatasets:\n  web:\n    - https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz\n  kaggle:\n    - titanic  # this need to be public dataset\n```\n\nIn both cases, the downloaded archive (Kaggle dataset is originally downloaded as zip file) is extracted to the default dataset folder under sub-folder with the same name as the downloaded file.\nTo get path to this dataset folder, please use environment variable `PATH_DATASETS`, so in your script use:\n\n```py\nimport os\n\ndata_path = os.environ.get(\"PATH_DATASETS\", \"_datasets\")\npath_titanic = os.path.join(data_path, \"titanic\")\n```\n\n**Warning:** some Kaggle datasets can be quite large and the process is - downloading and extracting, which means that particular runner needs to have double free space. For this reason, the CPU runner is limited to 3GB datasets.\n\n## Suggestions \u0026 limitations\n\n- For inserting images into text cells use MarkDown formatting, so we can insert inline images to the notebooks directly and drop eventual dependency on internet connection -\u003e generated notebooks could be better shared offline\n- If your images need special sizes, use `![Cation](my-image.png){height=\"60px\" width=\"240px\"}`\n- If your notebook is computational or any other resource (CPU/RAM) demanding use only GPU accelerator option in meta config\n- Kaggle datasets outage due to credentials issue...\n\n## Development tips\n\n### Handy notes\n\nOn the back side of publishing workflow you can find in principle these three steps\n\n```bash\n# 1) convert script to notebooks\njupytext --set-formats ipynb,py:percent notebook.py\n\n# 2) [OPTIONAL] testing the created notebook\npytest -v notebook.ipynb  --nbval\n\n# 3) generating notebooks outputs\npapermill in-notebook.ipynb out-notebook.ipynb\n```\n\n### Local Docs build\n\nYou may want to build the documentation local without need to excrete all notebooks.\nIn such case you can convert all scripts to ipython notebooks as dry run...\n\n```bash\n# set skip notebooks execution, just conversion\nexport DRY_RUN=1\n# generate notebooks from scripts\nmake ipynb\n# build the documentation\nmake docs\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightning-ai%2Ftutorials","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flightning-ai%2Ftutorials","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightning-ai%2Ftutorials/lists"}