Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Merge branch 'Lightning-Universe:master' into numpy
Browse files Browse the repository at this point in the history
  • Loading branch information
souravraha authored Aug 3, 2023
2 parents 2740677 + 8ad3a96 commit a093de1
Show file tree
Hide file tree
Showing 259 changed files with 970 additions and 864 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ updates:
# Enable version updates for python
- package-ecosystem: "pip"
# Look for a `requirements` in the `root` directory
directory: "/"
directory: "/requirements"
# Check for updates once a week
schedule:
interval: "weekly"
Expand Down
2 changes: 1 addition & 1 deletion .github/mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ pull_request_rules:
actions:
request_reviews:
teams:
- "@Lightning-AI/core-flash"
- "@Lightning-Universe/core-Flash"
4 changes: 2 additions & 2 deletions .github/workflows/ci-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ on:

jobs:
check-schema:
uses: Lightning-AI/utilities/.github/workflows/check-schema.yml@v0.8.0
uses: Lightning-AI/utilities/.github/workflows/check-schema.yml@v0.9.0
with:
# todo: validation has some problem with `- ${{ each topic in parameters.domains }}:` construct
azure-dir: ""

check-package:
uses: Lightning-AI/utilities/.github/workflows/check-package.yml@v0.8.0
uses: Lightning-AI/utilities/.github/workflows/check-package.yml@v0.9.0
with:
actions-ref: v0.8.0
artifact-name: dist-packages-${{ github.sha }}
Expand Down
82 changes: 59 additions & 23 deletions .github/workflows/ci-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ name: CI testing
on: # Trigger the workflow on push or pull request, but only for the master branch
push:
branches: ["master", "release/*"]
pull_request:
branches: ["master", "release/*"]
pull_request: {}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
Expand All @@ -16,8 +15,8 @@ defaults:
shell: bash

jobs:
pytester:

pytester:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -42,13 +41,18 @@ jobs:
- { os: 'ubuntu-20.04', python-version: 3.9, topic: 'graph', extra: [] }
- { os: 'ubuntu-20.04', python-version: 3.9, topic: 'audio', extra: [] }
- { os: 'ubuntu-20.04', python-version: 3.8, topic: 'core', extra: [], requires: 'oldest' }
- { os: 'ubuntu-20.04', python-version: 3.8, topic: 'serve', extra: [], requires: 'oldest' }
- { os: 'ubuntu-20.04', python-version: 3.8, topic: 'image', extra: [], requires: 'oldest' }
- { os: 'ubuntu-20.04', python-version: 3.8, topic: 'vision', extra: [], requires: 'oldest' }
- { os: 'ubuntu-20.04', python-version: 3.9, topic: 'tabular', extra: [], requires: 'oldest' }
- { os: 'ubuntu-20.04', python-version: 3.9, topic: 'text', extra: [], requires: 'oldest' }
#- { os: 'ubuntu-20.04', python-version: 3.8, topic: 'serve', extra: [], requires: 'oldest' } # todo

# Timeout: https://stackoverflow.com/a/59076067/4521646
timeout-minutes: 50
env:
FREEZE_REQUIREMENTS: 1
TORCH_URL: https://download.pytorch.org/whl/cpu/torch_stable.html
TRANSFORMERS_CACHE: _hf_cache

steps:
- uses: actions/checkout@v3
Expand All @@ -67,7 +71,6 @@ jobs:
- name: Setup macOS
if: runner.os == 'macOS'
run: brew install libomp openblas lapack

- name: Setup Ubuntu
if: runner.os == 'Linux'
run: sudo apt-get install -y libsndfile1 graphviz
Expand All @@ -76,8 +79,7 @@ jobs:
if: matrix.requires == 'oldest'
run: |
import glob, os
files = glob.glob(os.path.join("requirements", "*.txt")) + ['requirements.txt']
files = ['requirements.txt']
files = glob.glob(os.path.join("requirements", "*.txt"))
for fname in files:
lines = [line.replace('>=', '==') for line in open(fname).readlines()]
open(fname, 'w').writelines(lines)
Expand All @@ -91,30 +93,57 @@ jobs:
gh_env.write(f"EXTRAS={','.join(extras)}")
shell: python

- name: Get pip cache dir
id: pip-cache
run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Restore pip cache
uses: actions/cache/restore@v3
id: restore-cache
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: pip-dependencies

- name: Install package
run: |
# todo: some dependency has not correct format of their extras
python -m pip install "pip==22.3.1"
# todo: this is a hack to be able to install packages that are checking torch version while install
pip install numpy Cython "torch>=1.11.0" -f $TORCH_URL
pip install .[$EXTRAS,test] --upgrade \
--prefer-binary \
-f $TORCH_URL \
-f https://data.pyg.org/whl/torch-1.13.1+cpu.html # this extra URL is for graph extras
pip list
- name: Restore HF cache
uses: actions/cache/restore@v3
with:
path: ${{ env.TRANSFORMERS_CACHE }}
key: cache-transformers

- name: DocTests
working-directory: src/
run: |
mv flash flashy
pytest . --doctest-modules --doctest-plus
mv flashy flash
- name: Install dependencies
env:
TORCH_URL: https://download.pytorch.org/whl/cpu/torch_stable.html
run: |
python -m pip install "pip==22.2.1"
pip install numpy Cython "torch>=1.7.1" -f $TORCH_URL
pip install .[$EXTRAS,test] \
-r requirements/testing_${{ matrix.topic }}.txt \
--upgrade --prefer-binary -f $TORCH_URL
pip cache info
pip list
- name: Cache datasets
uses: actions/cache@v3
- name: Save pip cache
if: github.ref == 'refs/heads/master'
uses: actions/cache/save@v3
with:
path: data # This path is specific to Ubuntu
key: flash-datasets-${{ hashFiles('tests/examples/test_scripts.py') }}
restore-keys: flash-datasets-

# ToDO
#- name: DocTests
# run: |
# pytest src/ -vv # --reruns 3 --reruns-delay 2
path: ${{ steps.pip-cache.outputs.dir }}
key: pip-dependencies

- name: Tests
- name: Testing
run: |
coverage run --source flash -m pytest \
tests/core \
Expand All @@ -124,6 +153,13 @@ jobs:
tests/${{ matrix.topic }} \
-v # --reruns 3 --reruns-delay 2
- name: Save HF cache
if: github.ref == 'refs/heads/master'
uses: actions/cache/save@v3
with:
path: ${{ env.TRANSFORMERS_CACHE }}
key: cache-transformers

- name: Statistics
run: |
coverage report
Expand All @@ -134,7 +170,7 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
flags: unittests,${{ matrix.topic }},${{ matrix.extra }}
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
Expand Down
113 changes: 59 additions & 54 deletions .github/workflows/docs-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,27 @@ name: "Check Docs"
# https://github.com/marketplace/actions/sphinx-build

on: # Trigger the workflow on push or pull request, but only for the master branch
push: {}
pull_request:
push:
branches: [master]
pull_request: {}

env:
FREEZE_REQUIREMENTS: 1
TORCH_URL: https://download.pytorch.org/whl/cpu/torch_stable.html
TRANSFORMERS_CACHE: _hf_cache

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
cancel-in-progress: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }}

defaults:
run:
shell: bash

jobs:

make-docs:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3
with:
Expand All @@ -21,28 +31,29 @@ jobs:
with:
python-version: 3.8

# Note: This uses an internal pip API and may not always work
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: pip-${{ hashFiles('requirements.txt') }}
path: ~/.cache/pip # this is specific for Ubuntu
key: pip-${{ hashFiles('requirements/*.txt') }}
restore-keys: pip-

- name: Install dependencies
run: |
sudo apt-get update --fix-missing
# 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
pip --version
pip install . --find-links https://download.pytorch.org/whl/cpu/torch_stable.html
pip install --requirement requirements/docs.txt
pip install -e . -r requirements/docs.txt -f $TORCH_URL
pip list
shell: bash
- name: Cache transformers
uses: actions/cache@v3
with:
path: ${{ env.TRANSFORMERS_CACHE }}
key: cache-transformers

- name: Make Documentation
working-directory: docs
working-directory: docs/
run: make html --debug --jobs 2 SPHINXOPTS="-W --keep-going"

- name: Upload built docs
Expand All @@ -51,48 +62,42 @@ jobs:
name: docs-results-${{ github.sha }}
path: docs/build/html/


test-docs:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
with:
python-version: 3.8

# Note: This uses an internal pip API and may not always work
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: pip-${{ hashFiles('requirements/base.txt') }}
restore-keys: pip-

- name: Install dependencies
run: |
sudo apt-get update --fix-missing
sudo apt-get install -y cmake pandoc libsndfile1
pip --version
pip install '.[all,test]' --find-links https://download.pytorch.org/whl/cpu/torch_stable.html
pip install --requirement requirements/docs.txt
pip list
shell: bash

- name: Cache datasets
uses: actions/cache@v3
with:
path: |
docs/data
data
key: flash-datasets-docs

- name: Test Documentation
working-directory: docs
env:
SPHINX_MOCK_REQUIREMENTS: 0
FIFTYONE_DO_NOT_TRACK: true
FLASH_TESTING: 1
run: make doctest
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip # this is specific for Ubuntu
key: pip-${{ hashFiles('requirements/*.txt') }}
restore-keys: pip-

- name: Install dependencies
run: |
sudo apt-get update --fix-missing
sudo apt-get install -y cmake pandoc libsndfile1
pip --version
pip install -e '.[all,test]' -r requirements/docs.txt -f $TORCH_URL
pip list
- name: Cache transformers
uses: actions/cache@v3
with:
path: ${{ env.TRANSFORMERS_CACHE }}
key: cache-transformers

- name: Test Documentation
working-directory: docs/
env:
SPHINX_MOCK_REQUIREMENTS: 0
FIFTYONE_DO_NOT_TRACK: true
FLASH_TESTING: 1
run: make doctest
16 changes: 11 additions & 5 deletions .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@ jobs:
python-version: 3.8

- name: Install dependencies
run: pip install --user --upgrade setuptools wheel build
- name: Build
run: |
python -m build
ls -lh dist/
run: python -m pip install -U setuptools wheel build twine
- name: Build package
run: python -m build
- name: Check package
run: twine check dist/*

- name: Upload to release
uses: AButler/[email protected]
with:
files: 'dist/*'
repo-token: ${{ secrets.GITHUB_TOKEN }}

# We do this, since failures on test.pypi aren't that bad
- name: Publish to Test PyPI
Expand Down
Loading

0 comments on commit a093de1

Please sign in to comment.