From 08f3be5c8a396be59ae2b6a20273b9b009346794 Mon Sep 17 00:00:00 2001 From: Jirka Date: Wed, 4 Oct 2023 00:24:04 +0200 Subject: [PATCH 1/5] ci/docs: split building html | linkcheck --- .github/workflows/ci_docs.yml | 38 ++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci_docs.yml b/.github/workflows/ci_docs.yml index 3caf1a3d1..7747112a0 100644 --- a/.github/workflows/ci_docs.yml +++ b/.github/workflows/ci_docs.yml @@ -10,11 +10,19 @@ on: # Trigger the workflow on push or pull request concurrency: group: ${{ github.workflow }}-${{ github.head_ref }} - cancel-in-progress: true + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +defaults: + run: + shell: bash jobs: - build-docs: + make-docs: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + check: ["html", "linkcheck"] env: PUB_BRANCH: publication PATH_DATASETS: ${{ github.workspace }}/.datasets @@ -35,16 +43,17 @@ jobs: key: pip-${{ hashFiles('requirements.txt') }}-${{ hashFiles('_requirements/docs.txt') }} restore-keys: pip- - - name: Install dependencies + - name: Install Texlive & tree run: | sudo apt-get update --fix-missing - sudo apt-get install -y tree # install Texlive, see https://linuxconfig.org/how-to-install-latex-on-ubuntu-20-04-focal-fossa-linux - sudo apt-get install -y cmake pandoc texlive-latex-extra dvipng texlive-pictures + sudo apt-get install -y cmake tree pandoc texlive-latex-extra dvipng texlive-pictures + + - name: Install dependencies + run: | pip --version pip install -q -r requirements.txt -r _requirements/docs.txt pip list - shell: bash - name: Process folders run: | @@ -54,7 +63,6 @@ jobs: python .actions/assistant.py group-folders master-diff.txt printf "Changed folders:\n" cat changed-folders.txt - shell: bash - name: ">> output" id: changed @@ -69,6 +77,8 @@ jobs: - name: Generate notebooks if: steps.changed.outputs.nb_dirs != 0 + env: + DRY_RUN: 1 run: | # second half with || [...] is needed for reading the last line while read -r line || [ -n "$line" ]; do @@ -77,9 +87,6 @@ jobs: cat .actions/_ipynb-render.sh bash .actions/_ipynb-render.sh done <<< $(cat changed-folders.txt) - env: - DRY_RUN: 1 - shell: bash - name: Copy notebooks if: steps.changed.outputs.nb_dirs != 0 @@ -91,7 +98,6 @@ jobs: cp .notebooks/${line}.ipynb changed-notebooks/${dir}/ done <<< $(cat changed-folders.txt) tree changed-notebooks - shell: bash - uses: actions/upload-artifact@v3 if: steps.changed.outputs.nb_dirs != 0 @@ -99,14 +105,18 @@ jobs: name: notebooks-${{ github.sha }} path: changed-notebooks/ + - name: Link check + working-directory: ./_docs + if: ${{ matrix.check == 'linkcheck' }} + run: make linkcheck --jobs $(nproc) --debug SPHINXOPTS="--keep-going" + - name: Make Documentation working-directory: ./_docs - run: make html --jobs $(nproc) --debug SPHINXOPTS="-W --keep-going" linkcheck + if: ${{ matrix.check == 'html' }} + run: make html --jobs $(nproc) --debug SPHINXOPTS="-W --keep-going" - name: Upload built docs uses: actions/upload-artifact@v3 with: name: docs-html-${{ github.sha }} path: _docs/build/html/ - # Use always() to always run this step to publish test results when there are test failures - if: success() From 918fb2b90cc2efdb1018db7249b7ec735a2c807a Mon Sep 17 00:00:00 2001 From: Jirka Date: Wed, 4 Oct 2023 00:31:54 +0200 Subject: [PATCH 2/5] env --- .github/workflows/ci_docs.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci_docs.yml b/.github/workflows/ci_docs.yml index 7747112a0..3ea6e9a07 100644 --- a/.github/workflows/ci_docs.yml +++ b/.github/workflows/ci_docs.yml @@ -64,19 +64,18 @@ jobs: printf "Changed folders:\n" cat changed-folders.txt - - name: ">> output" - id: changed - run: python -c "lines = open('changed-folders.txt').readlines(); print(f'::set-output name=nb_dirs::{len(lines)}')" + - name: Count changed notebooks + run: python -c "lines = open('changed-folders.txt').readlines(); print(f'NB_DIRS={len(lines)}')" >> $GITHUB_ENV - uses: oleksiyrudenko/gha-git-credentials@v2.1 with: - token: "${{ secrets.GITHUB_TOKEN }}" + token: ${{ secrets.GITHUB_TOKEN }} global: true - name: Sync to pub run: git merge -s resolve origin/$PUB_BRANCH - name: Generate notebooks - if: steps.changed.outputs.nb_dirs != 0 + if: ${{ env.NB_DIRS != 0 }} env: DRY_RUN: 1 run: | @@ -89,7 +88,7 @@ jobs: done <<< $(cat changed-folders.txt) - name: Copy notebooks - if: steps.changed.outputs.nb_dirs != 0 + if: ${{ env.NB_DIRS != 0 }} run: | # second half with || [...] is needed for reading the last line while read -r line || [ -n "$line" ]; do @@ -100,7 +99,7 @@ jobs: tree changed-notebooks - uses: actions/upload-artifact@v3 - if: steps.changed.outputs.nb_dirs != 0 + if: ${{ matrix.check == 'html' && emv.NB_DIRS != 0 }} with: name: notebooks-${{ github.sha }} path: changed-notebooks/ @@ -116,6 +115,7 @@ jobs: run: make html --jobs $(nproc) --debug SPHINXOPTS="-W --keep-going" - name: Upload built docs + if: ${{ matrix.check == 'html' }} uses: actions/upload-artifact@v3 with: name: docs-html-${{ github.sha }} From 368d0397cf6601809fa4cd157379d0d787cc5d37 Mon Sep 17 00:00:00 2001 From: Jirka Date: Wed, 4 Oct 2023 00:34:12 +0200 Subject: [PATCH 3/5] link --- .../Deep_Energy_Models.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/course_UvA-DL/07-deep-energy-based-generative-models/Deep_Energy_Models.py b/course_UvA-DL/07-deep-energy-based-generative-models/Deep_Energy_Models.py index 05ca2f9a4..58e843b18 100644 --- a/course_UvA-DL/07-deep-energy-based-generative-models/Deep_Energy_Models.py +++ b/course_UvA-DL/07-deep-energy-based-generative-models/Deep_Energy_Models.py @@ -172,8 +172,7 @@ # The trick is that we approximate $Z_{\theta}$ by a single Monte-Carlo sample. # This gives us the exact same objective as written above. # -# Visually, we can look at the objective as follows (figure credit -# - [Stefano Ermon and Aditya Grover](https://deepgenerativemodels.github.io/assets/slides/cs236_lecture11.pdf)): +# Visually, we can look at the objective as follows (figure credit - Stefano Ermon and Aditya Grover: lecture cs236/11): # #
# @@ -206,8 +205,7 @@ # Modeling the probability distribution for sampling new data is not the only application of energy-based models. # Any application which requires us to compare two elements is much simpler to learn # because we just need to go for the higher energy. -# A couple of examples are shown below (figure credit -# - [Stefano Ermon and Aditya Grover](https://deepgenerativemodels.github.io/assets/slides/cs236_lecture11.pdf)). +# A couple of examples are shown below (figure credit - Stefano Ermon and Aditya Grover: lecture cs236/11). # A classification setup like object recognition or sequence labeling can be considered as an energy-based # task as we just need to find the $Y$ input that minimizes the output $E(X, Y)$ (hence maximizes probability). # Similarly, a popular application of energy-based models is denoising of images. From a6af72d09ef38cd0496cfacf4c0ba07cc0ae6891 Mon Sep 17 00:00:00 2001 From: Jirka Date: Wed, 4 Oct 2023 00:39:57 +0200 Subject: [PATCH 4/5] schema --- .github/workflows/ci_docs.yml | 2 +- .github/workflows/ci_schema.yml | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci_schema.yml diff --git a/.github/workflows/ci_docs.yml b/.github/workflows/ci_docs.yml index 3ea6e9a07..77a181de1 100644 --- a/.github/workflows/ci_docs.yml +++ b/.github/workflows/ci_docs.yml @@ -99,7 +99,7 @@ jobs: tree changed-notebooks - uses: actions/upload-artifact@v3 - if: ${{ matrix.check == 'html' && emv.NB_DIRS != 0 }} + if: ${{ matrix.check == 'html' && env.NB_DIRS != 0 }} with: name: notebooks-${{ github.sha }} path: changed-notebooks/ diff --git a/.github/workflows/ci_schema.yml b/.github/workflows/ci_schema.yml new file mode 100644 index 000000000..55e7e83f3 --- /dev/null +++ b/.github/workflows/ci_schema.yml @@ -0,0 +1,15 @@ +name: Check Schema + +on: + push: + branches: [master, "release/*"] + pull_request: + branches: [master, "release/*"] + +jobs: + check: + uses: Lightning-AI/utilities/.github/workflows/check-schema.yml@main + with: + # skip azure due to the wrong schema file by MSFT + # https://github.com/Lightning-AI/lightning-flash/pull/1455#issuecomment-1244793607 + azure-dir: ".azure" From 67205e5383bcb66f8383db0384a933fe66bf4ba8 Mon Sep 17 00:00:00 2001 From: Jirka Date: Wed, 4 Oct 2023 00:41:01 +0200 Subject: [PATCH 5/5] main --- .github/workflows/ci_schema.yml | 4 ++-- .github/workflows/ci_test-acts.yml | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_schema.yml b/.github/workflows/ci_schema.yml index 55e7e83f3..d79c027fb 100644 --- a/.github/workflows/ci_schema.yml +++ b/.github/workflows/ci_schema.yml @@ -2,9 +2,9 @@ name: Check Schema on: push: - branches: [master, "release/*"] + branches: [main] pull_request: - branches: [master, "release/*"] + branches: [main] jobs: check: diff --git a/.github/workflows/ci_test-acts.yml b/.github/workflows/ci_test-acts.yml index 2bfb1e1c0..095cceedc 100644 --- a/.github/workflows/ci_test-acts.yml +++ b/.github/workflows/ci_test-acts.yml @@ -2,7 +2,8 @@ name: CI internal # see: https://help.github.com/en/actions/reference/events-that-trigger-workflows on: # Trigger the workflow on push or pull request, but only for the main branch - push: {} + push: + branches: [main] pull_request: branches: [main]