Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
9bow committed Jul 29, 2023
1 parent 05dd51c commit 848d963
Show file tree
Hide file tree
Showing 1,534 changed files with 103,775 additions and 232,944 deletions.
474 changes: 474 additions & 0 deletions .actions/assistant.py

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions .actions/pull_legacy_checkpoints.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Run this script from the project root.
URL="https://pl-public-data.s3.amazonaws.com/legacy/checkpoints.zip"
mkdir -p tests/legacy
# wget is simpler but does not work on Windows
python -c "from urllib.request import urlretrieve; urlretrieve('$URL', 'tests/legacy/checkpoints.zip')"
ls -l tests/legacy/

unzip -o tests/legacy/checkpoints.zip -d tests/legacy/
ls -l tests/legacy/checkpoints/
2 changes: 2 additions & 0 deletions .actions/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jsonargparse>=4.16.0
requests
90 changes: 68 additions & 22 deletions .github/workflows/deploy-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,93 @@
name: gh-pages deploy
name: Build Lightning Docs & Deploy to gh-pages

on:
push:
branches:
- master

defaults:
run:
shell: bash

env:
FREEZE_REQUIREMENTS: "1"
TORCH_URL: "https://download.pytorch.org/whl/cpu/torch_stable.html"
PYPI_CACHE_DIR: "_pip-wheels"

jobs:
build:
make-html:
runs-on: ubuntu-latest
container:
image: pytorchlightning/pytorch_lightning:docs
strategy:
fail-fast: false
matrix:
pkg-name: ["app", "fabric", "pytorch"]
steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Set up Python 3.8
uses: actions/setup-python@v3
- name: pip wheels cache
uses: actions/cache/restore@v3
with:
python-version: '3.8'
path: ${{ env.PYPI_CACHE_DIR }}
key: pypi_wheels

- name: Upgrade pip
run: python3 -m pip install --upgrade pip
- name: Install package & dependencies
run: |
mkdir -p $PYPI_CACHE_DIR # in case cache was not hit
ls -lh $PYPI_CACHE_DIR
mkdir -p pypi_pkgs # in case template is not pulled
pip --version
pip install -U -r requirements.txt \
-f pypi_pkgs/ -f $PYPI_CACHE_DIR -f ${TORCH_URL}
pip install -U -r requirements/${{ matrix.pkg-name }}/docs.txt \
-f pypi_pkgs/ -f $PYPI_CACHE_DIR -f ${TORCH_URL}
pip list
shell: bash

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

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

- name: Install dependencies
run: pip install -r requirements.txt
- name: Upload built docs
uses: actions/upload-artifact@v3
with:
name: docs-${{ matrix.pkg-name }}-${{ github.sha }}
path: docs/build/html/
retention-days: ${{ steps.keep-artifact.outputs.DAYS }}

- name: Build Sphinx documents
run: make docs
- name: Dump handy wheels
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
continue-on-error: true
uses: ./.github/actions/pip-wheels
with:
wheel-dir: ${{ env.PYPI_CACHE_DIR }}
torch-url: ${{ env.TORCH_URL }}
cache-key: "pypi_wheels"

deploy-docs:
needs: [make-html]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pkg-name: ["app", "fabric", "pytorch"]
steps:
- uses: actions/download-artifact@v3
with:
name: docs-${{ matrix.pkg-name }}-${{ github.sha }}
path: docs/build/html/
- name: Deploy to gh-pages branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.DEPLOY_TOKEN }}
publish_dir: ./build/html
publish_dir: ./docs/build/html
cname: docs.pytorchlightning.kr
enable_jekyll: false
force_orphan: true
Expand Down
82 changes: 64 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,30 @@
.DS_Store
run_configs/
model_weights/
app/models/
pip-wheel-metadata/
lightning_logs/
.vscode/

# Test-tube
test_tube_*/

# Documentations
docs/source/api
docs/source/*.md
docs/source/generated
docs/source/*/generated
docs/source/notebooks
docs/source/_static/images/course_UvA-DL
docs/source/_static/images/lightning_examples
docs/venv*/
docs/build*/
docs/source-app/generated
docs/source-app/*/generated
docs/source-app/_static/fetched-s3-assets
docs/source-fabric/_static/fetched-s3-assets
docs/source-pytorch/api
docs/source-pytorch/*.md
docs/source-pytorch/generated
docs/source-pytorch/*/generated
docs/source-pytorch/notebooks
docs/source-pytorch/_static/images/course_UvA-DL
docs/source-pytorch/_static/images/lightning_examples
docs/source-pytorch/_static/fetched-s3-assets

docs/source-fabric/*/generated

# C extensions
*.so
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand All @@ -27,11 +34,6 @@ timit_data/
grid_generated*
grid_ori*



# C extensions
*.so

# PyCharm
.idea/

Expand All @@ -53,6 +55,18 @@ wheels/
*.egg-info/
.installed.cfg
*.egg
src/*/version.info
src/lightning_app/*
src/lightning_fabric/*
src/pytorch_lightning/*
!src/*/__about__.py
!src/*/__main__.py
!src/*/__setup__.py
!src/*/__version__.py
!src/*/MANIFEST.in
!src/*/py.typed
!src/*/README.md
!src/*/shell-folder_code-lives-lightning.info

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down Expand Up @@ -113,6 +127,8 @@ celerybeat-schedule

# dotenv
.env
.env.staging
.env.local

# virtualenv
.venv
Expand All @@ -134,13 +150,15 @@ ENV/
.mypy_cache/
# pytest
.pytest_cache/
# ruff
.ruff_cache/

# data
.data/
Datasets/
mnist/
MNIST/
legacy/checkpoints/
tests/legacy/checkpoints/
*.gz
*ubyte

Expand All @@ -149,7 +167,6 @@ ml-runs/
mlruns/
*.zip
*.ckpt
pytorch\ lightning
test-reports/
wandb
.forked/
Expand All @@ -163,3 +180,32 @@ cifar-10-batches-py
# ctags
tags
.tags
src/lightning_app/ui/*
src/lightning/app/ui/*
*examples/template_react_ui*
hars*
artifacts/*
*docs/examples*

# tutorials
our_model.tar
test.png
saved_models
data/
!src/lightning/data/
!examples/data/
!tests/tests_pytorch/utilities/data/
!requirements/data/
.shared
.lightning
node_modules/

# examples
**/events.out.tfevents.*
examples/**/*.png

# CI
.wheels/

# sourced notebooks from tutorials
_notebooks/.notebooks/
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "_notebooks"]
path = _notebooks
url = https://github.com/PyTorchKorea/lightning-tutorials-kr.git
branch = publication
16 changes: 16 additions & 0 deletions .lightningignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
_notebooks
.azure
.github
.ipynb_checkpoints
.pytest_cache
.shared
.storage
.venv
.vscode
.git
artifacts
Datasets
dist
docs
examples
tests
53 changes: 33 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,38 @@
# Minimal makefile for Sphinx documentation
#
.PHONY: test clean docs

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

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -v
clean:
# clean all temp runs
rm -rf $(shell find . -name "mlruns")
rm -rf $(shell find . -name "lightning_log")
rm -rf $(shell find . -name "lightning_logs")
rm -rf _ckpt_*
rm -rf .mypy_cache
rm -rf .pytest_cache
rm -rf ./docs/build
rm -rf ./docs/source-fabric/api/generated
rm -rf ./docs/source-pytorch/notebooks
rm -rf ./docs/source-pytorch/generated
rm -rf ./docs/source-pytorch/*/generated
rm -rf ./docs/source-pytorch/api
rm -rf ./docs/source-app/generated
rm -rf ./docs/source-app/*/generated
rm -rf build
rm -rf dist
rm -rf *.egg-info

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

.PHONY: all docs clean
update:
git submodule update --init --recursive --remote
Loading

0 comments on commit 848d963

Please sign in to comment.