Skip to content

Commit 848d963

Browse files
committed
1 parent 05dd51c commit 848d963

File tree

1,534 files changed

+103775
-232944
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,534 files changed

+103775
-232944
lines changed

โ€Ž.actions/assistant.py

+474
Large diffs are not rendered by default.
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
# Run this script from the project root.
4+
URL="https://pl-public-data.s3.amazonaws.com/legacy/checkpoints.zip"
5+
mkdir -p tests/legacy
6+
# wget is simpler but does not work on Windows
7+
python -c "from urllib.request import urlretrieve; urlretrieve('$URL', 'tests/legacy/checkpoints.zip')"
8+
ls -l tests/legacy/
9+
10+
unzip -o tests/legacy/checkpoints.zip -d tests/legacy/
11+
ls -l tests/legacy/checkpoints/

โ€Ž.actions/requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
jsonargparse>=4.16.0
2+
requests

โ€Ž.github/workflows/deploy-gh-pages.yml

+68-22
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,93 @@
1-
name: gh-pages deploy
1+
name: Build Lightning Docs & Deploy to gh-pages
22

33
on:
44
push:
55
branches:
66
- master
77

8+
defaults:
9+
run:
10+
shell: bash
11+
12+
env:
13+
FREEZE_REQUIREMENTS: "1"
14+
TORCH_URL: "https://download.pytorch.org/whl/cpu/torch_stable.html"
15+
PYPI_CACHE_DIR: "_pip-wheels"
16+
817
jobs:
9-
build:
18+
make-html:
1019
runs-on: ubuntu-latest
20+
container:
21+
image: pytorchlightning/pytorch_lightning:docs
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
pkg-name: ["app", "fabric", "pytorch"]
1126
steps:
1227
- uses: actions/checkout@v3
28+
with:
29+
submodules: true
1330

14-
- name: Set up Python 3.8
15-
uses: actions/setup-python@v3
31+
- name: pip wheels cache
32+
uses: actions/cache/restore@v3
1633
with:
17-
python-version: '3.8'
34+
path: ${{ env.PYPI_CACHE_DIR }}
35+
key: pypi_wheels
1836

19-
- name: Upgrade pip
20-
run: python3 -m pip install --upgrade pip
37+
- name: Install package & dependencies
38+
run: |
39+
mkdir -p $PYPI_CACHE_DIR # in case cache was not hit
40+
ls -lh $PYPI_CACHE_DIR
41+
mkdir -p pypi_pkgs # in case template is not pulled
42+
pip --version
43+
pip install -U -r requirements.txt \
44+
-f pypi_pkgs/ -f $PYPI_CACHE_DIR -f ${TORCH_URL}
45+
pip install -U -r requirements/${{ matrix.pkg-name }}/docs.txt \
46+
-f pypi_pkgs/ -f $PYPI_CACHE_DIR -f ${TORCH_URL}
47+
pip list
48+
shell: bash
2149

22-
- name: Get pip cache dir
23-
id: pip-cache
24-
run: echo "::set-output name=dir::$(pip cache dir)"
50+
- name: Make Documentation
51+
working-directory: ./docs/source-${{ matrix.pkg-name }}
52+
run: make html --debug --jobs $(nproc) SPHINXOPTS="-W --keep-going"
2553

26-
- name: Cache dependencies
27-
uses: actions/cache@v2
28-
with:
29-
path: ${{ steps.pip-cache.outputs.dir }}
30-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
31-
restore-keys: |
32-
${{ runner.os }}-pip-
54+
- name: Keep artifact
55+
id: keep-artifact
56+
run: python -c "print('DAYS=' + str(7 if '${{ github.event_name }}'.startswith('pull_request') else 0))" >> $GITHUB_OUTPUT
3357

34-
- name: Install dependencies
35-
run: pip install -r requirements.txt
58+
- name: Upload built docs
59+
uses: actions/upload-artifact@v3
60+
with:
61+
name: docs-${{ matrix.pkg-name }}-${{ github.sha }}
62+
path: docs/build/html/
63+
retention-days: ${{ steps.keep-artifact.outputs.DAYS }}
3664

37-
- name: Build Sphinx documents
38-
run: make docs
65+
- name: Dump handy wheels
66+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
67+
continue-on-error: true
68+
uses: ./.github/actions/pip-wheels
69+
with:
70+
wheel-dir: ${{ env.PYPI_CACHE_DIR }}
71+
torch-url: ${{ env.TORCH_URL }}
72+
cache-key: "pypi_wheels"
3973

74+
deploy-docs:
75+
needs: [make-html]
76+
runs-on: ubuntu-latest
77+
strategy:
78+
fail-fast: false
79+
matrix:
80+
pkg-name: ["app", "fabric", "pytorch"]
81+
steps:
82+
- uses: actions/download-artifact@v3
83+
with:
84+
name: docs-${{ matrix.pkg-name }}-${{ github.sha }}
85+
path: docs/build/html/
4086
- name: Deploy to gh-pages branch
4187
uses: peaceiris/actions-gh-pages@v3
4288
with:
4389
github_token: ${{ secrets.DEPLOY_TOKEN }}
44-
publish_dir: ./build/html
90+
publish_dir: ./docs/build/html
4591
cname: docs.pytorchlightning.kr
4692
enable_jekyll: false
4793
force_orphan: true

โ€Ž.gitignore

+64-18
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,30 @@
22
.DS_Store
33
run_configs/
44
model_weights/
5-
app/models/
65
pip-wheel-metadata/
76
lightning_logs/
87
.vscode/
98

10-
# Test-tube
11-
test_tube_*/
12-
139
# Documentations
14-
docs/source/api
15-
docs/source/*.md
16-
docs/source/generated
17-
docs/source/*/generated
18-
docs/source/notebooks
19-
docs/source/_static/images/course_UvA-DL
20-
docs/source/_static/images/lightning_examples
10+
docs/venv*/
11+
docs/build*/
12+
docs/source-app/generated
13+
docs/source-app/*/generated
14+
docs/source-app/_static/fetched-s3-assets
15+
docs/source-fabric/_static/fetched-s3-assets
16+
docs/source-pytorch/api
17+
docs/source-pytorch/*.md
18+
docs/source-pytorch/generated
19+
docs/source-pytorch/*/generated
20+
docs/source-pytorch/notebooks
21+
docs/source-pytorch/_static/images/course_UvA-DL
22+
docs/source-pytorch/_static/images/lightning_examples
23+
docs/source-pytorch/_static/fetched-s3-assets
24+
25+
docs/source-fabric/*/generated
2126

27+
# C extensions
28+
*.so
2229
# Byte-compiled / optimized / DLL files
2330
__pycache__/
2431
*.py[cod]
@@ -27,11 +34,6 @@ timit_data/
2734
grid_generated*
2835
grid_ori*
2936

30-
31-
32-
# C extensions
33-
*.so
34-
3537
# PyCharm
3638
.idea/
3739

@@ -53,6 +55,18 @@ wheels/
5355
*.egg-info/
5456
.installed.cfg
5557
*.egg
58+
src/*/version.info
59+
src/lightning_app/*
60+
src/lightning_fabric/*
61+
src/pytorch_lightning/*
62+
!src/*/__about__.py
63+
!src/*/__main__.py
64+
!src/*/__setup__.py
65+
!src/*/__version__.py
66+
!src/*/MANIFEST.in
67+
!src/*/py.typed
68+
!src/*/README.md
69+
!src/*/shell-folder_code-lives-lightning.info
5670

5771
# PyInstaller
5872
# Usually these files are written by a python script from a template
@@ -113,6 +127,8 @@ celerybeat-schedule
113127

114128
# dotenv
115129
.env
130+
.env.staging
131+
.env.local
116132

117133
# virtualenv
118134
.venv
@@ -134,13 +150,15 @@ ENV/
134150
.mypy_cache/
135151
# pytest
136152
.pytest_cache/
153+
# ruff
154+
.ruff_cache/
137155

138156
# data
139157
.data/
140158
Datasets/
141159
mnist/
142160
MNIST/
143-
legacy/checkpoints/
161+
tests/legacy/checkpoints/
144162
*.gz
145163
*ubyte
146164

@@ -149,7 +167,6 @@ ml-runs/
149167
mlruns/
150168
*.zip
151169
*.ckpt
152-
pytorch\ lightning
153170
test-reports/
154171
wandb
155172
.forked/
@@ -163,3 +180,32 @@ cifar-10-batches-py
163180
# ctags
164181
tags
165182
.tags
183+
src/lightning_app/ui/*
184+
src/lightning/app/ui/*
185+
*examples/template_react_ui*
186+
hars*
187+
artifacts/*
188+
*docs/examples*
189+
190+
# tutorials
191+
our_model.tar
192+
test.png
193+
saved_models
194+
data/
195+
!src/lightning/data/
196+
!examples/data/
197+
!tests/tests_pytorch/utilities/data/
198+
!requirements/data/
199+
.shared
200+
.lightning
201+
node_modules/
202+
203+
# examples
204+
**/events.out.tfevents.*
205+
examples/**/*.png
206+
207+
# CI
208+
.wheels/
209+
210+
# sourced notebooks from tutorials
211+
_notebooks/.notebooks/

โ€Ž.gitmodules

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "_notebooks"]
2+
path = _notebooks
3+
url = https://github.com/PyTorchKorea/lightning-tutorials-kr.git
4+
branch = publication

โ€Ž.lightningignore

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
_notebooks
2+
.azure
3+
.github
4+
.ipynb_checkpoints
5+
.pytest_cache
6+
.shared
7+
.storage
8+
.venv
9+
.vscode
10+
.git
11+
artifacts
12+
Datasets
13+
dist
14+
docs
15+
examples
16+
tests

โ€ŽMakefile

+33-20
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,38 @@
1-
# Minimal makefile for Sphinx documentation
2-
#
1+
.PHONY: test clean docs
32

4-
# You can set these variables from the command line.
5-
SPHINXOPTS =
6-
SPHINXBUILD = sphinx-build
7-
SOURCEDIR = source
8-
BUILDDIR = build
3+
# to imitate SLURM set only single node
4+
export SLURM_LOCALID=0
5+
# assume you have installed need packages
6+
export SPHINX_MOCK_REQUIREMENTS=1
7+
# install only Lightning Trainer packages
8+
export PACKAGE_NAME=pytorch
99

10-
# Put it first so that "make" without argument is like "make help".
11-
help:
12-
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
13-
14-
.PHONY: help Makefile
15-
16-
# Catch-all target: route all unknown targets to Sphinx using the new
17-
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
18-
%: Makefile
19-
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -v
10+
clean:
11+
# clean all temp runs
12+
rm -rf $(shell find . -name "mlruns")
13+
rm -rf $(shell find . -name "lightning_log")
14+
rm -rf $(shell find . -name "lightning_logs")
15+
rm -rf _ckpt_*
16+
rm -rf .mypy_cache
17+
rm -rf .pytest_cache
18+
rm -rf ./docs/build
19+
rm -rf ./docs/source-fabric/api/generated
20+
rm -rf ./docs/source-pytorch/notebooks
21+
rm -rf ./docs/source-pytorch/generated
22+
rm -rf ./docs/source-pytorch/*/generated
23+
rm -rf ./docs/source-pytorch/api
24+
rm -rf ./docs/source-app/generated
25+
rm -rf ./docs/source-app/*/generated
26+
rm -rf build
27+
rm -rf dist
28+
rm -rf *.egg-info
2029

2130
docs:
22-
make html
23-
echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
31+
git submodule update --init --recursive # get Notebook submodule
32+
pip install -qq lightning # install (stable) Lightning from PyPI instead of src
33+
pip install -qq -r requirements/app/base.txt
34+
pip install -qq -r requirements/pytorch/docs.txt
35+
cd docs/source-pytorch && $(MAKE) html --jobs $(nproc) && cd ../../
2436

25-
.PHONY: all docs clean
37+
update:
38+
git submodule update --init --recursive --remote

0 commit comments

Comments
ย (0)