From de946c8b47fd3cd6c19db281d61f651c3dab7603 Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Sun, 23 Feb 2025 20:54:05 -0500 Subject: [PATCH 1/6] fix: remove Optimisers.jl patch feat: support general optimisers fix: incorrect field name fix: setup under jit chore: run formatter ci: run only reactant for now (drop me) fix: make_reactant_compatible after setup fix: support all optimisers correctly test: annotate fix: offload all pathces to Optimisers --- .github/workflows/CI.yml | 20 +- .github/workflows/CIPreRelease.yml | 10 +- .github/workflows/CI_LuxCUDA.yml | 150 +++++------ .github/workflows/CI_LuxCore.yml | 206 +++++++-------- .github/workflows/CI_LuxLib.yml | 278 ++++++++++---------- .github/workflows/CI_LuxTestUtils.yml | 164 ++++++------ .github/workflows/CI_MLDataDevices.yml | 186 ++++++------- .github/workflows/CI_WeightInitializers.yml | 164 ++++++------ Project.toml | 3 +- docs/Project.toml | 2 +- examples/Basics/Project.toml | 2 +- examples/CIFAR10/Project.toml | 2 +- examples/ConvolutionalVAE/Project.toml | 2 +- examples/DDIM/Project.toml | 2 +- examples/GCN_Cora/Project.toml | 2 +- examples/HyperNet/Project.toml | 2 +- examples/ImageNet/Project.toml | 2 +- examples/NeuralODE/Project.toml | 2 +- examples/PINN2DPDE/Project.toml | 2 +- examples/PolynomialFitting/Project.toml | 2 +- examples/RealNVP/Project.toml | 2 +- examples/SimpleChains/Project.toml | 2 +- examples/SimpleRNN/Project.toml | 2 +- ext/LuxReactantExt/LuxReactantExt.jl | 3 +- ext/LuxReactantExt/patches.jl | 5 + src/helpers/optimizers.jl | 152 +---------- src/helpers/training.jl | 9 +- test/Project.toml | 5 +- test/layers/embedding_tests.jl | 4 +- test/reactant/training_tests.jl | 32 ++- 30 files changed, 659 insertions(+), 760 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b391fa66b6..4a56295cbd 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -37,11 +37,11 @@ jobs: os: - ubuntu-latest test_group: - - "core_layers" - - "normalize_layers" - - "recurrent_layers" - - "autodiff" - - "misc" + # - "core_layers" + # - "normalize_layers" + # - "recurrent_layers" + # - "autodiff" + # - "misc" - "reactant" steps: - uses: actions/checkout@v4 @@ -86,11 +86,11 @@ jobs: fail-fast: false matrix: test_group: - - "core_layers" - - "normalize_layers" - - "recurrent_layers" - - "autodiff" - - "misc" + # - "core_layers" + # - "normalize_layers" + # - "recurrent_layers" + # - "autodiff" + # - "misc" - "reactant" steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/CIPreRelease.yml b/.github/workflows/CIPreRelease.yml index 52f237806a..da84bdeccc 100644 --- a/.github/workflows/CIPreRelease.yml +++ b/.github/workflows/CIPreRelease.yml @@ -36,11 +36,11 @@ jobs: os: - ubuntu-latest test_group: - - "core_layers" - - "normalize_layers" - - "recurrent_layers" - - "autodiff" - - "misc" + # - "core_layers" + # - "normalize_layers" + # - "recurrent_layers" + # - "autodiff" + # - "misc" - "reactant" steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/CI_LuxCUDA.yml b/.github/workflows/CI_LuxCUDA.yml index e310da1a30..eefd973d5c 100644 --- a/.github/workflows/CI_LuxCUDA.yml +++ b/.github/workflows/CI_LuxCUDA.yml @@ -1,79 +1,79 @@ -name: CI (LuxCUDA) -on: - pull_request: - branches: - - main - paths: - - "lib/LuxCUDA/**" - - ".github/workflows/CI_LuxCUDA.yml" - push: - branches: - - main +# name: CI (LuxCUDA) +# on: +# pull_request: +# branches: +# - main +# paths: +# - "lib/LuxCUDA/**" +# - ".github/workflows/CI_LuxCUDA.yml" +# push: +# branches: +# - main -concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: only if it is a pull request build. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} +# concurrency: +# # Skip intermediate builds: always. +# # Cancel intermediate builds: only if it is a pull request build. +# group: ${{ github.workflow }}-${{ github.ref }} +# cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} -jobs: - test: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - version: - - "1" - steps: - - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v2 - with: - version: ${{ matrix.version }} - - uses: julia-actions/cache@v2 - - uses: julia-actions/julia-buildpkg@v1 - with: - project: "lib/LuxCUDA" - - name: "Run Tests" - run: | - import Pkg - Pkg.test(; coverage="user") - shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxCUDA {0} - - uses: julia-actions/julia-processcoverage@v1 - with: - directories: lib/LuxCUDA/src - - uses: codecov/codecov-action@v5 - with: - files: lcov.info - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true - fail_ci_if_error: false +# jobs: +# test: +# runs-on: ubuntu-latest +# strategy: +# fail-fast: false +# matrix: +# version: +# - "1" +# steps: +# - uses: actions/checkout@v4 +# - uses: julia-actions/setup-julia@v2 +# with: +# version: ${{ matrix.version }} +# - uses: julia-actions/cache@v2 +# - uses: julia-actions/julia-buildpkg@v1 +# with: +# project: "lib/LuxCUDA" +# - name: "Run Tests" +# run: | +# import Pkg +# Pkg.test(; coverage="user") +# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxCUDA {0} +# - uses: julia-actions/julia-processcoverage@v1 +# with: +# directories: lib/LuxCUDA/src +# - uses: codecov/codecov-action@v5 +# with: +# files: lcov.info +# token: ${{ secrets.CODECOV_TOKEN }} +# verbose: true +# fail_ci_if_error: false - downgrade: - if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && github.base_ref == github.event.repository.default_branch }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v2 - with: - version: "1.10" - - uses: julia-actions/julia-downgrade-compat@v1 - - uses: julia-actions/julia-buildpkg@v1 - with: - project: "lib/LuxCUDA" - - name: "Run Tests" - run: | - import Pkg - Pkg.test(; coverage="user") - shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxCUDA {0} - - uses: julia-actions/julia-processcoverage@v1 - with: - directories: lib/LuxCUDA/src - - uses: codecov/codecov-action@v5 - with: - files: lcov.info - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true - fail_ci_if_error: false +# downgrade: +# if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && github.base_ref == github.event.repository.default_branch }} +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# - uses: julia-actions/setup-julia@v2 +# with: +# version: "1.10" +# - uses: julia-actions/julia-downgrade-compat@v1 +# - uses: julia-actions/julia-buildpkg@v1 +# with: +# project: "lib/LuxCUDA" +# - name: "Run Tests" +# run: | +# import Pkg +# Pkg.test(; coverage="user") +# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxCUDA {0} +# - uses: julia-actions/julia-processcoverage@v1 +# with: +# directories: lib/LuxCUDA/src +# - uses: codecov/codecov-action@v5 +# with: +# files: lcov.info +# token: ${{ secrets.CODECOV_TOKEN }} +# verbose: true +# fail_ci_if_error: false -env: - BACKEND_GROUP: "CPU" +# env: +# BACKEND_GROUP: "CPU" diff --git a/.github/workflows/CI_LuxCore.yml b/.github/workflows/CI_LuxCore.yml index bda2d79fc0..3a25131e87 100644 --- a/.github/workflows/CI_LuxCore.yml +++ b/.github/workflows/CI_LuxCore.yml @@ -1,107 +1,107 @@ -name: CI (LuxCore) -on: - pull_request: - branches: - - main - paths: - - "lib/LuxCore/**" - - ".github/workflows/CI_LuxCore.yml" - - "lib/MLDataDevices/**" - push: - branches: - - main +# name: CI (LuxCore) +# on: +# pull_request: +# branches: +# - main +# paths: +# - "lib/LuxCore/**" +# - ".github/workflows/CI_LuxCore.yml" +# - "lib/MLDataDevices/**" +# push: +# branches: +# - main -concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: only if it is a pull request build. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} +# concurrency: +# # Skip intermediate builds: always. +# # Cancel intermediate builds: only if it is a pull request build. +# group: ${{ github.workflow }}-${{ github.ref }} +# cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} -jobs: - test: - if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - version: - - "1" - os: - - ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v2 - with: - version: ${{ matrix.version }} - - uses: julia-actions/cache@v2 - - uses: julia-actions/julia-buildpkg@v1 - with: - project: "lib/LuxCore" - - name: "Dev Test Dependencies" - run: | - import Pkg - dev_pkgs = Pkg.PackageSpec[] - for pkg in ("lib/LuxCore", "lib/MLDataDevices") - push!(dev_pkgs, Pkg.PackageSpec(path=pkg)) - end - Pkg.develop(dev_pkgs) - shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxCore/test {0} - - name: "Run Tests" - run: | - import Pkg, LuxCore - dir = dirname(pathof(LuxCore)) - include(joinpath(dir, "../test/runtests.jl")) - shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxCore/test {0} - - uses: julia-actions/julia-processcoverage@v1 - with: - directories: lib/LuxCore/src,lib/LuxCore/ext,lib/MLDataDevices/src,lib/MLDataDevices/ext - - uses: codecov/codecov-action@v5 - with: - files: lcov.info - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true - fail_ci_if_error: false +# jobs: +# test: +# if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }} +# runs-on: ${{ matrix.os }} +# strategy: +# fail-fast: false +# matrix: +# version: +# - "1" +# os: +# - ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# - uses: julia-actions/setup-julia@v2 +# with: +# version: ${{ matrix.version }} +# - uses: julia-actions/cache@v2 +# - uses: julia-actions/julia-buildpkg@v1 +# with: +# project: "lib/LuxCore" +# - name: "Dev Test Dependencies" +# run: | +# import Pkg +# dev_pkgs = Pkg.PackageSpec[] +# for pkg in ("lib/LuxCore", "lib/MLDataDevices") +# push!(dev_pkgs, Pkg.PackageSpec(path=pkg)) +# end +# Pkg.develop(dev_pkgs) +# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxCore/test {0} +# - name: "Run Tests" +# run: | +# import Pkg, LuxCore +# dir = dirname(pathof(LuxCore)) +# include(joinpath(dir, "../test/runtests.jl")) +# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxCore/test {0} +# - uses: julia-actions/julia-processcoverage@v1 +# with: +# directories: lib/LuxCore/src,lib/LuxCore/ext,lib/MLDataDevices/src,lib/MLDataDevices/ext +# - uses: codecov/codecov-action@v5 +# with: +# files: lcov.info +# token: ${{ secrets.CODECOV_TOKEN }} +# verbose: true +# fail_ci_if_error: false - downgrade: - if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && github.base_ref == github.event.repository.default_branch }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - version: ["1.10"] - steps: - - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v2 - with: - version: ${{ matrix.version }} - - uses: julia-actions/julia-downgrade-compat@v1 - - uses: julia-actions/julia-buildpkg@v1 - with: - project: "lib/LuxCore" - - name: "Dev Test Dependencies" - run: | - import Pkg - dev_pkgs = Pkg.PackageSpec[] - for pkg in ("lib/LuxCore", "lib/MLDataDevices") - push!(dev_pkgs, Pkg.PackageSpec(path=pkg)) - end - Pkg.develop(dev_pkgs) - shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxCore/test {0} - - name: "Run Tests" - run: | - import Pkg, LuxCore - dir = dirname(pathof(LuxCore)) - include(joinpath(dir, "../test/runtests.jl")) - shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxCore/test {0} - - uses: julia-actions/julia-processcoverage@v1 - with: - directories: lib/LuxCore/src,lib/LuxCore/ext,lib/MLDataDevices/src,lib/MLDataDevices/ext - - uses: codecov/codecov-action@v5 - with: - files: lcov.info - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true - fail_ci_if_error: false +# downgrade: +# if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && github.base_ref == github.event.repository.default_branch }} +# runs-on: ubuntu-latest +# strategy: +# fail-fast: false +# matrix: +# version: ["1.10"] +# steps: +# - uses: actions/checkout@v4 +# - uses: julia-actions/setup-julia@v2 +# with: +# version: ${{ matrix.version }} +# - uses: julia-actions/julia-downgrade-compat@v1 +# - uses: julia-actions/julia-buildpkg@v1 +# with: +# project: "lib/LuxCore" +# - name: "Dev Test Dependencies" +# run: | +# import Pkg +# dev_pkgs = Pkg.PackageSpec[] +# for pkg in ("lib/LuxCore", "lib/MLDataDevices") +# push!(dev_pkgs, Pkg.PackageSpec(path=pkg)) +# end +# Pkg.develop(dev_pkgs) +# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxCore/test {0} +# - name: "Run Tests" +# run: | +# import Pkg, LuxCore +# dir = dirname(pathof(LuxCore)) +# include(joinpath(dir, "../test/runtests.jl")) +# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxCore/test {0} +# - uses: julia-actions/julia-processcoverage@v1 +# with: +# directories: lib/LuxCore/src,lib/LuxCore/ext,lib/MLDataDevices/src,lib/MLDataDevices/ext +# - uses: codecov/codecov-action@v5 +# with: +# files: lcov.info +# token: ${{ secrets.CODECOV_TOKEN }} +# verbose: true +# fail_ci_if_error: false -env: - BACKEND_GROUP: "CPU" +# env: +# BACKEND_GROUP: "CPU" diff --git a/.github/workflows/CI_LuxLib.yml b/.github/workflows/CI_LuxLib.yml index c13b5ee22b..1a01be1116 100644 --- a/.github/workflows/CI_LuxLib.yml +++ b/.github/workflows/CI_LuxLib.yml @@ -1,143 +1,143 @@ -name: CI (LuxLib) -on: - pull_request: - branches: - - main - paths: - - "lib/LuxLib/**" - - ".github/workflows/CI_LuxLib.yml" - - "lib/LuxTestUtils/**" - - "lib/LuxCore/**" - - "lib/MLDataDevices/**" - push: - branches: - - main +# name: CI (LuxLib) +# on: +# pull_request: +# branches: +# - main +# paths: +# - "lib/LuxLib/**" +# - ".github/workflows/CI_LuxLib.yml" +# - "lib/LuxTestUtils/**" +# - "lib/LuxCore/**" +# - "lib/MLDataDevices/**" +# push: +# branches: +# - main -concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: only if it is a pull request build. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} +# concurrency: +# # Skip intermediate builds: always. +# # Cancel intermediate builds: only if it is a pull request build. +# group: ${{ github.workflow }}-${{ github.ref }} +# cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} -jobs: - test: - if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - version: - - "1" - os: - - ubuntu-latest - test_group: - - "conv" - - "dense" - - "normalization" - - "misc" - blas_backend: - - "default" - loopvec: - - "true" - include: - - version: "1" - os: ubuntu-latest - test_group: "dense" - blas_backend: "default" - loopvec: "false" - - version: "1" - os: ubuntu-latest - test_group: "misc" - blas_backend: "default" - loopvec: "false" - steps: - - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v2 - with: - version: ${{ matrix.version }} - - uses: julia-actions/cache@v2 - - uses: julia-actions/julia-buildpkg@v1 - with: - project: "lib/LuxLib" - - name: "Dev Test Dependencies" - run: | - import Pkg - dev_pkgs = Pkg.PackageSpec[] - for pkg in ("lib/LuxTestUtils", "lib/LuxLib", "lib/MLDataDevices") - push!(dev_pkgs, Pkg.PackageSpec(path=pkg)) - end - Pkg.develop(dev_pkgs) - shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxLib/test {0} - - name: "Run Tests" - run: | - import Pkg, LuxLib - dir = dirname(pathof(LuxLib)) - include(joinpath(dir, "../test/runtests.jl")) - shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxLib/test {0} - env: - LUXLIB_TEST_GROUP: ${{ matrix.test_group }} - LUXLIB_BLAS_BACKEND: ${{ matrix.blas_backend }} - LUXLIB_LOAD_LOOPVEC: ${{ matrix.loopvec }} - - uses: julia-actions/julia-processcoverage@v1 - with: - directories: lib/LuxLib/src,lib/LuxLib/ext,lib/LuxCore/src,lib/LuxCore/ext,lib/MLDataDevices/src,lib/MLDataDevices/ext,lib/LuxTestUtils/src - - uses: codecov/codecov-action@v5 - with: - files: lcov.info - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true - fail_ci_if_error: false +# jobs: +# test: +# if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }} +# runs-on: ${{ matrix.os }} +# strategy: +# fail-fast: false +# matrix: +# version: +# - "1" +# os: +# - ubuntu-latest +# test_group: +# - "conv" +# - "dense" +# - "normalization" +# - "misc" +# blas_backend: +# - "default" +# loopvec: +# - "true" +# include: +# - version: "1" +# os: ubuntu-latest +# test_group: "dense" +# blas_backend: "default" +# loopvec: "false" +# - version: "1" +# os: ubuntu-latest +# test_group: "misc" +# blas_backend: "default" +# loopvec: "false" +# steps: +# - uses: actions/checkout@v4 +# - uses: julia-actions/setup-julia@v2 +# with: +# version: ${{ matrix.version }} +# - uses: julia-actions/cache@v2 +# - uses: julia-actions/julia-buildpkg@v1 +# with: +# project: "lib/LuxLib" +# - name: "Dev Test Dependencies" +# run: | +# import Pkg +# dev_pkgs = Pkg.PackageSpec[] +# for pkg in ("lib/LuxTestUtils", "lib/LuxLib", "lib/MLDataDevices") +# push!(dev_pkgs, Pkg.PackageSpec(path=pkg)) +# end +# Pkg.develop(dev_pkgs) +# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxLib/test {0} +# - name: "Run Tests" +# run: | +# import Pkg, LuxLib +# dir = dirname(pathof(LuxLib)) +# include(joinpath(dir, "../test/runtests.jl")) +# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxLib/test {0} +# env: +# LUXLIB_TEST_GROUP: ${{ matrix.test_group }} +# LUXLIB_BLAS_BACKEND: ${{ matrix.blas_backend }} +# LUXLIB_LOAD_LOOPVEC: ${{ matrix.loopvec }} +# - uses: julia-actions/julia-processcoverage@v1 +# with: +# directories: lib/LuxLib/src,lib/LuxLib/ext,lib/LuxCore/src,lib/LuxCore/ext,lib/MLDataDevices/src,lib/MLDataDevices/ext,lib/LuxTestUtils/src +# - uses: codecov/codecov-action@v5 +# with: +# files: lcov.info +# token: ${{ secrets.CODECOV_TOKEN }} +# verbose: true +# fail_ci_if_error: false - downgrade: - if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && github.base_ref == github.event.repository.default_branch }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - test_group: - - "conv" - - "dense" - - "normalization" - - "misc" - steps: - - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v2 - with: - version: "1.10" - - uses: julia-actions/julia-downgrade-compat@v1 - with: - skip: "LuxCore,MLDataDevices" - - uses: julia-actions/julia-buildpkg@v1 - with: - project: "lib/LuxLib" - - name: "Dev Test Dependencies" - run: | - import Pkg - dev_pkgs = Pkg.PackageSpec[] - for pkg in ("lib/LuxTestUtils", "lib/LuxLib", "lib/MLDataDevices") - push!(dev_pkgs, Pkg.PackageSpec(path=pkg)) - end - Pkg.develop(dev_pkgs) - shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxLib/test {0} - - name: "Run Tests" - run: | - import Pkg, LuxLib - dir = dirname(pathof(LuxLib)) - include(joinpath(dir, "../test/runtests.jl")) - shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxLib/test {0} - env: - LUXLIB_TEST_GROUP: ${{ matrix.test_group }} - LUXLIB_BLAS_BACKEND: "default" - LUXLIB_LOAD_LOOPVEC: "true" - - uses: julia-actions/julia-processcoverage@v1 - with: - directories: lib/LuxLib/src,lib/LuxLib/ext,lib/LuxCore/src,lib/LuxCore/ext,lib/MLDataDevices/src,lib/MLDataDevices/ext,lib/LuxTestUtils/src - - uses: codecov/codecov-action@v5 - with: - files: lcov.info - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true - fail_ci_if_error: false +# downgrade: +# if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && github.base_ref == github.event.repository.default_branch }} +# runs-on: ubuntu-latest +# strategy: +# fail-fast: false +# matrix: +# test_group: +# - "conv" +# - "dense" +# - "normalization" +# - "misc" +# steps: +# - uses: actions/checkout@v4 +# - uses: julia-actions/setup-julia@v2 +# with: +# version: "1.10" +# - uses: julia-actions/julia-downgrade-compat@v1 +# with: +# skip: "LuxCore,MLDataDevices" +# - uses: julia-actions/julia-buildpkg@v1 +# with: +# project: "lib/LuxLib" +# - name: "Dev Test Dependencies" +# run: | +# import Pkg +# dev_pkgs = Pkg.PackageSpec[] +# for pkg in ("lib/LuxTestUtils", "lib/LuxLib", "lib/MLDataDevices") +# push!(dev_pkgs, Pkg.PackageSpec(path=pkg)) +# end +# Pkg.develop(dev_pkgs) +# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxLib/test {0} +# - name: "Run Tests" +# run: | +# import Pkg, LuxLib +# dir = dirname(pathof(LuxLib)) +# include(joinpath(dir, "../test/runtests.jl")) +# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxLib/test {0} +# env: +# LUXLIB_TEST_GROUP: ${{ matrix.test_group }} +# LUXLIB_BLAS_BACKEND: "default" +# LUXLIB_LOAD_LOOPVEC: "true" +# - uses: julia-actions/julia-processcoverage@v1 +# with: +# directories: lib/LuxLib/src,lib/LuxLib/ext,lib/LuxCore/src,lib/LuxCore/ext,lib/MLDataDevices/src,lib/MLDataDevices/ext,lib/LuxTestUtils/src +# - uses: codecov/codecov-action@v5 +# with: +# files: lcov.info +# token: ${{ secrets.CODECOV_TOKEN }} +# verbose: true +# fail_ci_if_error: false -env: - BACKEND_GROUP: "CPU" +# env: +# BACKEND_GROUP: "CPU" diff --git a/.github/workflows/CI_LuxTestUtils.yml b/.github/workflows/CI_LuxTestUtils.yml index 2d9c30f391..f8fb03de32 100644 --- a/.github/workflows/CI_LuxTestUtils.yml +++ b/.github/workflows/CI_LuxTestUtils.yml @@ -1,86 +1,86 @@ -name: CI (LuxTestUtils) -on: - pull_request: - branches: - - main - paths: - - "lib/LuxTestUtils/**" - - ".github/workflows/CI_LuxTestUtils.yml" - push: - branches: - - main +# name: CI (LuxTestUtils) +# on: +# pull_request: +# branches: +# - main +# paths: +# - "lib/LuxTestUtils/**" +# - ".github/workflows/CI_LuxTestUtils.yml" +# push: +# branches: +# - main -concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: only if it is a pull request build. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} +# concurrency: +# # Skip intermediate builds: always. +# # Cancel intermediate builds: only if it is a pull request build. +# group: ${{ github.workflow }}-${{ github.ref }} +# cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} -jobs: - test: - if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - version: - - "1" - os: - - ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v2 - with: - version: ${{ matrix.version }} - - uses: julia-actions/cache@v2 - - uses: julia-actions/julia-buildpkg@v1 - with: - project: "lib/LuxTestUtils" - - name: "Run Tests" - run: | - import Pkg - Pkg.test(; coverage="user") - shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxTestUtils {0} - - uses: julia-actions/julia-processcoverage@v1 - with: - directories: lib/LuxTestUtils/src,lib/MLDataDevices/src,lib/MLDataDevices/ext - - uses: codecov/codecov-action@v5 - with: - files: lcov.info - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true - fail_ci_if_error: false +# jobs: +# test: +# if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }} +# runs-on: ${{ matrix.os }} +# strategy: +# fail-fast: false +# matrix: +# version: +# - "1" +# os: +# - ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# - uses: julia-actions/setup-julia@v2 +# with: +# version: ${{ matrix.version }} +# - uses: julia-actions/cache@v2 +# - uses: julia-actions/julia-buildpkg@v1 +# with: +# project: "lib/LuxTestUtils" +# - name: "Run Tests" +# run: | +# import Pkg +# Pkg.test(; coverage="user") +# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxTestUtils {0} +# - uses: julia-actions/julia-processcoverage@v1 +# with: +# directories: lib/LuxTestUtils/src,lib/MLDataDevices/src,lib/MLDataDevices/ext +# - uses: codecov/codecov-action@v5 +# with: +# files: lcov.info +# token: ${{ secrets.CODECOV_TOKEN }} +# verbose: true +# fail_ci_if_error: false - downgrade: - if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && github.base_ref == github.event.repository.default_branch }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - version: ["1.10"] - steps: - - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v2 - with: - version: ${{ matrix.version }} - - uses: julia-actions/julia-downgrade-compat@v1 - - uses: julia-actions/julia-buildpkg@v1 - with: - project: "lib/LuxTestUtils" - - name: "Run Tests" - run: | - import Pkg - Pkg.test(; coverage="user") - shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxTestUtils {0} - - uses: julia-actions/julia-processcoverage@v1 - with: - directories: lib/LuxTestUtils/src - - uses: codecov/codecov-action@v5 - with: - files: lcov.info - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true - fail_ci_if_error: false +# downgrade: +# if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && github.base_ref == github.event.repository.default_branch }} +# runs-on: ubuntu-latest +# strategy: +# fail-fast: false +# matrix: +# version: ["1.10"] +# steps: +# - uses: actions/checkout@v4 +# - uses: julia-actions/setup-julia@v2 +# with: +# version: ${{ matrix.version }} +# - uses: julia-actions/julia-downgrade-compat@v1 +# - uses: julia-actions/julia-buildpkg@v1 +# with: +# project: "lib/LuxTestUtils" +# - name: "Run Tests" +# run: | +# import Pkg +# Pkg.test(; coverage="user") +# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxTestUtils {0} +# - uses: julia-actions/julia-processcoverage@v1 +# with: +# directories: lib/LuxTestUtils/src +# - uses: codecov/codecov-action@v5 +# with: +# files: lcov.info +# token: ${{ secrets.CODECOV_TOKEN }} +# verbose: true +# fail_ci_if_error: false -env: - BACKEND_GROUP: "CPU" +# env: +# BACKEND_GROUP: "CPU" diff --git a/.github/workflows/CI_MLDataDevices.yml b/.github/workflows/CI_MLDataDevices.yml index ba60a0ed0c..9e482f7363 100644 --- a/.github/workflows/CI_MLDataDevices.yml +++ b/.github/workflows/CI_MLDataDevices.yml @@ -1,97 +1,97 @@ -name: CI (MLDataDevices) -on: - pull_request: - branches: - - main - paths: - - "lib/MLDataDevices/**" - - ".github/workflows/CI_MLDataDevices.yml" - push: - branches: - - main +# name: CI (MLDataDevices) +# on: +# pull_request: +# branches: +# - main +# paths: +# - "lib/MLDataDevices/**" +# - ".github/workflows/CI_MLDataDevices.yml" +# push: +# branches: +# - main -concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: only if it is a pull request build. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} +# concurrency: +# # Skip intermediate builds: always. +# # Cancel intermediate builds: only if it is a pull request build. +# group: ${{ github.workflow }}-${{ github.ref }} +# cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} -jobs: - test: - if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - version: - - "1" - os: - - ubuntu-latest - - macos-latest - - windows-latest - group: - - CPU - - XLA - exclude: - - os: windows-latest - group: XLA - steps: - - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v2 - with: - version: ${{ matrix.version }} - - uses: julia-actions/cache@v2 - - uses: julia-actions/julia-buildpkg@v1 - with: - project: "lib/MLDataDevices" - - name: "Run Tests" - run: | - import Pkg - Pkg.test(; coverage="user") - shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/MLDataDevices {0} - env: - BACKEND_GROUP: ${{ matrix.group }} - - uses: julia-actions/julia-processcoverage@v1 - with: - directories: lib/MLDataDevices/src,lib/MLDataDevices/ext - - uses: codecov/codecov-action@v5 - with: - files: lcov.info - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true - fail_ci_if_error: false +# jobs: +# test: +# if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }} +# runs-on: ${{ matrix.os }} +# strategy: +# fail-fast: false +# matrix: +# version: +# - "1" +# os: +# - ubuntu-latest +# - macos-latest +# - windows-latest +# group: +# - CPU +# - XLA +# exclude: +# - os: windows-latest +# group: XLA +# steps: +# - uses: actions/checkout@v4 +# - uses: julia-actions/setup-julia@v2 +# with: +# version: ${{ matrix.version }} +# - uses: julia-actions/cache@v2 +# - uses: julia-actions/julia-buildpkg@v1 +# with: +# project: "lib/MLDataDevices" +# - name: "Run Tests" +# run: | +# import Pkg +# Pkg.test(; coverage="user") +# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/MLDataDevices {0} +# env: +# BACKEND_GROUP: ${{ matrix.group }} +# - uses: julia-actions/julia-processcoverage@v1 +# with: +# directories: lib/MLDataDevices/src,lib/MLDataDevices/ext +# - uses: codecov/codecov-action@v5 +# with: +# files: lcov.info +# token: ${{ secrets.CODECOV_TOKEN }} +# verbose: true +# fail_ci_if_error: false - downgrade: - if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && github.base_ref == github.event.repository.default_branch }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - version: - - "1.10" - steps: - - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v2 - with: - version: ${{ matrix.version }} - - uses: julia-actions/julia-downgrade-compat@v1 - - uses: julia-actions/julia-buildpkg@v1 - with: - project: "lib/MLDataDevices" - - name: "Run Tests" - run: | - import Pkg - Pkg.test(; coverage="user") - shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/MLDataDevices {0} - - uses: julia-actions/julia-processcoverage@v1 - with: - directories: lib/MLDataDevices/src,lib/MLDataDevices/ext - - uses: codecov/codecov-action@v5 - with: - files: lcov.info - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true - fail_ci_if_error: false +# downgrade: +# if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && github.base_ref == github.event.repository.default_branch }} +# runs-on: ubuntu-latest +# strategy: +# fail-fast: false +# matrix: +# version: +# - "1.10" +# steps: +# - uses: actions/checkout@v4 +# - uses: julia-actions/setup-julia@v2 +# with: +# version: ${{ matrix.version }} +# - uses: julia-actions/julia-downgrade-compat@v1 +# - uses: julia-actions/julia-buildpkg@v1 +# with: +# project: "lib/MLDataDevices" +# - name: "Run Tests" +# run: | +# import Pkg +# Pkg.test(; coverage="user") +# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/MLDataDevices {0} +# - uses: julia-actions/julia-processcoverage@v1 +# with: +# directories: lib/MLDataDevices/src,lib/MLDataDevices/ext +# - uses: codecov/codecov-action@v5 +# with: +# files: lcov.info +# token: ${{ secrets.CODECOV_TOKEN }} +# verbose: true +# fail_ci_if_error: false -env: - BACKEND_GROUP: "CPU" +# env: +# BACKEND_GROUP: "CPU" diff --git a/.github/workflows/CI_WeightInitializers.yml b/.github/workflows/CI_WeightInitializers.yml index 5d1c4dab86..a1f51804fd 100644 --- a/.github/workflows/CI_WeightInitializers.yml +++ b/.github/workflows/CI_WeightInitializers.yml @@ -1,86 +1,86 @@ -name: CI (WeightInitializers) -on: - pull_request: - branches: - - main - paths: - - "lib/WeightInitializers/**" - - ".github/workflows/CI_WeightInitializers.yml" - push: - branches: - - main +# name: CI (WeightInitializers) +# on: +# pull_request: +# branches: +# - main +# paths: +# - "lib/WeightInitializers/**" +# - ".github/workflows/CI_WeightInitializers.yml" +# push: +# branches: +# - main -concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: only if it is a pull request build. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} +# concurrency: +# # Skip intermediate builds: always. +# # Cancel intermediate builds: only if it is a pull request build. +# group: ${{ github.workflow }}-${{ github.ref }} +# cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} -jobs: - test: - if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - version: - - "1" - os: - - ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v2 - with: - version: ${{ matrix.version }} - - uses: julia-actions/cache@v2 - - uses: julia-actions/julia-buildpkg@v1 - with: - project: "lib/WeightInitializers" - - name: "Run Tests" - run: | - import Pkg - Pkg.test(; coverage="user") - shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/WeightInitializers {0} - - uses: julia-actions/julia-processcoverage@v1 - with: - directories: lib/WeightInitializers/src,lib/WeightInitializers/ext - - uses: codecov/codecov-action@v5 - with: - files: lcov.info - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true - fail_ci_if_error: false +# jobs: +# test: +# if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }} +# runs-on: ${{ matrix.os }} +# strategy: +# fail-fast: false +# matrix: +# version: +# - "1" +# os: +# - ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# - uses: julia-actions/setup-julia@v2 +# with: +# version: ${{ matrix.version }} +# - uses: julia-actions/cache@v2 +# - uses: julia-actions/julia-buildpkg@v1 +# with: +# project: "lib/WeightInitializers" +# - name: "Run Tests" +# run: | +# import Pkg +# Pkg.test(; coverage="user") +# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/WeightInitializers {0} +# - uses: julia-actions/julia-processcoverage@v1 +# with: +# directories: lib/WeightInitializers/src,lib/WeightInitializers/ext +# - uses: codecov/codecov-action@v5 +# with: +# files: lcov.info +# token: ${{ secrets.CODECOV_TOKEN }} +# verbose: true +# fail_ci_if_error: false - downgrade: - if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && github.base_ref == github.event.repository.default_branch }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - version: ["1.10"] - steps: - - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v2 - with: - version: ${{ matrix.version }} - - uses: julia-actions/julia-downgrade-compat@v1 - - uses: julia-actions/julia-buildpkg@v1 - with: - project: "lib/WeightInitializers" - - name: "Run Tests" - run: | - import Pkg - Pkg.test(; coverage="user") - shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/WeightInitializers {0} - - uses: julia-actions/julia-processcoverage@v1 - with: - directories: lib/WeightInitializers/src,lib/WeightInitializers/ext - - uses: codecov/codecov-action@v5 - with: - files: lcov.info - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true - fail_ci_if_error: false +# downgrade: +# if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && github.base_ref == github.event.repository.default_branch }} +# runs-on: ubuntu-latest +# strategy: +# fail-fast: false +# matrix: +# version: ["1.10"] +# steps: +# - uses: actions/checkout@v4 +# - uses: julia-actions/setup-julia@v2 +# with: +# version: ${{ matrix.version }} +# - uses: julia-actions/julia-downgrade-compat@v1 +# - uses: julia-actions/julia-buildpkg@v1 +# with: +# project: "lib/WeightInitializers" +# - name: "Run Tests" +# run: | +# import Pkg +# Pkg.test(; coverage="user") +# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/WeightInitializers {0} +# - uses: julia-actions/julia-processcoverage@v1 +# with: +# directories: lib/WeightInitializers/src,lib/WeightInitializers/ext +# - uses: codecov/codecov-action@v5 +# with: +# files: lcov.info +# token: ${{ secrets.CODECOV_TOKEN }} +# verbose: true +# fail_ci_if_error: false -env: - BACKEND_GROUP: "CPU" +# env: +# BACKEND_GROUP: "CPU" diff --git a/Project.toml b/Project.toml index f94d33244b..a71502dd76 100644 --- a/Project.toml +++ b/Project.toml @@ -58,6 +58,7 @@ LuxCore = {path = "lib/LuxCore"} LuxLib = {path = "lib/LuxLib"} MLDataDevices = {path = "lib/MLDataDevices"} WeightInitializers = {path = "lib/WeightInitializers"} +Optimisers = {url="https://github.com/avik-pal/Optimisers.jl", rev="ap/fix_check"} [extensions] LuxComponentArraysExt = "ComponentArrays" @@ -104,7 +105,7 @@ MacroTools = "0.5.13" Markdown = "1.10" NCCL = "0.1.1" NNlib = "0.9.26" -Optimisers = "0.4.1" +Optimisers = "0.4.6" Preferences = "1.4.3" Random = "1.10" Reactant = "0.2.55" diff --git a/docs/Project.toml b/docs/Project.toml index 831d3b1414..ee5220eb8a 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -62,7 +62,7 @@ LuxLib = "1.3.4" LuxTestUtils = "1.5" MLDataDevices = "1.6.10" NNlib = "0.9.26" -Optimisers = "0.4.1" +Optimisers = "0.4.6" Printf = "1.10" Random = "1.10" Reactant = "0.2.55" diff --git a/examples/Basics/Project.toml b/examples/Basics/Project.toml index 087eec95a7..bd3aac2436 100644 --- a/examples/Basics/Project.toml +++ b/examples/Basics/Project.toml @@ -11,5 +11,5 @@ Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" ComponentArrays = "0.15.22" ForwardDiff = "0.10, 1" Lux = "1" -Optimisers = "0.4.1" +Optimisers = "0.4.6" Zygote = "0.6.70, 0.7" diff --git a/examples/CIFAR10/Project.toml b/examples/CIFAR10/Project.toml index e7e90d1119..f74c0b65bf 100644 --- a/examples/CIFAR10/Project.toml +++ b/examples/CIFAR10/Project.toml @@ -35,7 +35,7 @@ LuxCUDA = "0.3.2" MLDatasets = "0.7.14" MLUtils = "0.4.4" OneHotArrays = "0.2.5" -Optimisers = "0.4.1" +Optimisers = "0.4.6" Printf = "1.10" ProgressTables = "0.1" Random = "1.10" diff --git a/examples/ConvolutionalVAE/Project.toml b/examples/ConvolutionalVAE/Project.toml index 093def46e8..8d0ea12461 100644 --- a/examples/ConvolutionalVAE/Project.toml +++ b/examples/ConvolutionalVAE/Project.toml @@ -23,7 +23,7 @@ Lux = "1.4.1" MLDatasets = "0.7.18" MLUtils = "0.4.4" OneHotArrays = "0.2.6" -Optimisers = "0.4" +Optimisers = "0.4.6" Printf = "1.10" Random = "1.10" Reactant = "0.2.55" diff --git a/examples/DDIM/Project.toml b/examples/DDIM/Project.toml index de5e544bd2..7ecf7e3b89 100644 --- a/examples/DDIM/Project.toml +++ b/examples/DDIM/Project.toml @@ -36,7 +36,7 @@ JLD2 = "0.4.48, 0.5" Lux = "1" LuxCUDA = "0.3" MLUtils = "0.4" -Optimisers = "0.4.1" +Optimisers = "0.4.6" ParameterSchedulers = "0.4.1" ProgressBars = "1" Random = "1.10" diff --git a/examples/GCN_Cora/Project.toml b/examples/GCN_Cora/Project.toml index fada8bd20c..ce60e15891 100644 --- a/examples/GCN_Cora/Project.toml +++ b/examples/GCN_Cora/Project.toml @@ -18,7 +18,7 @@ GNNGraphs = "1" Lux = "1.5" MLDatasets = "0.7.18" OneHotArrays = "0.2" -Optimisers = "0.4.4" +Optimisers = "0.4.6" Printf = "1.10" Random = "1.10" Reactant = "0.2.55" diff --git a/examples/HyperNet/Project.toml b/examples/HyperNet/Project.toml index e017048ba6..1bfbe76707 100644 --- a/examples/HyperNet/Project.toml +++ b/examples/HyperNet/Project.toml @@ -15,5 +15,5 @@ Lux = "1" MLDatasets = "0.7" MLUtils = "0.4" OneHotArrays = "0.2.5" -Optimisers = "0.4.1" +Optimisers = "0.4.6" Reactant = "0.2.55" diff --git a/examples/ImageNet/Project.toml b/examples/ImageNet/Project.toml index 96957a2ce1..b4bacc8591 100644 --- a/examples/ImageNet/Project.toml +++ b/examples/ImageNet/Project.toml @@ -38,7 +38,7 @@ MLUtils = "0.4.4" MPI = "0.20.21" NCCL = "0.1.1" OneHotArrays = "0.2.5" -Optimisers = "0.4.1" +Optimisers = "0.4.6" ParameterSchedulers = "0.4.2" Random = "1.10" Setfield = "1.1.1" diff --git a/examples/NeuralODE/Project.toml b/examples/NeuralODE/Project.toml index 99b7d7b297..ef804427b5 100644 --- a/examples/NeuralODE/Project.toml +++ b/examples/NeuralODE/Project.toml @@ -21,7 +21,7 @@ LuxCUDA = "0.3" MLDatasets = "0.7" MLUtils = "0.4" OneHotArrays = "0.2.5" -Optimisers = "0.4.1" +Optimisers = "0.4.6" OrdinaryDiffEqTsit5 = "1" SciMLSensitivity = "7.63" Statistics = "1" diff --git a/examples/PINN2DPDE/Project.toml b/examples/PINN2DPDE/Project.toml index 9dad2b3152..a4e4166ec5 100644 --- a/examples/PINN2DPDE/Project.toml +++ b/examples/PINN2DPDE/Project.toml @@ -18,7 +18,7 @@ Enzyme = "0.13" Lux = "1" MLUtils = "0.4.4" OnlineStats = "1.7.1" -Optimisers = "0.4.1" +Optimisers = "0.4.6" Printf = "1.10" Random = "1.10" Reactant = "0.2.55" diff --git a/examples/PolynomialFitting/Project.toml b/examples/PolynomialFitting/Project.toml index 939eabd585..f1f2d82a33 100644 --- a/examples/PolynomialFitting/Project.toml +++ b/examples/PolynomialFitting/Project.toml @@ -12,7 +12,7 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" ADTypes = "1.10" CairoMakie = "0.12, 0.13" Lux = "1" -Optimisers = "0.4.1" +Optimisers = "0.4.6" Printf = "1.10" Random = "1.10" Reactant = "0.2.55" diff --git a/examples/RealNVP/Project.toml b/examples/RealNVP/Project.toml index a52474e29f..6c3b673b9f 100644 --- a/examples/RealNVP/Project.toml +++ b/examples/RealNVP/Project.toml @@ -16,7 +16,7 @@ ConcreteStructs = "0.2.3" Enzyme = "0.13.35" Lux = "1.5" MLUtils = "0.4.5" -Optimisers = "0.4.4" +Optimisers = "0.4.6" Printf = "1.10" Random = "1.10" Reactant = "0.2.55" diff --git a/examples/SimpleChains/Project.toml b/examples/SimpleChains/Project.toml index be0f63a0d2..7dbfcbe973 100644 --- a/examples/SimpleChains/Project.toml +++ b/examples/SimpleChains/Project.toml @@ -17,7 +17,7 @@ Lux = "1" MLDatasets = "0.7.14" MLUtils = "0.4" OneHotArrays = "0.2.5" -Optimisers = "0.4.1" +Optimisers = "0.4.6" Random = "1" Reactant = "0.2.55" SimpleChains = "0.4.6" diff --git a/examples/SimpleRNN/Project.toml b/examples/SimpleRNN/Project.toml index df235d9131..083c6ece8f 100644 --- a/examples/SimpleRNN/Project.toml +++ b/examples/SimpleRNN/Project.toml @@ -13,5 +13,5 @@ ADTypes = "1.10" JLD2 = "0.5" Lux = "1" MLUtils = "0.4" -Optimisers = "0.4.1" +Optimisers = "0.4.6" Reactant = "0.2.55" diff --git a/ext/LuxReactantExt/LuxReactantExt.jl b/ext/LuxReactantExt/LuxReactantExt.jl index 76e1be5ab1..f8c8a81b28 100644 --- a/ext/LuxReactantExt/LuxReactantExt.jl +++ b/ext/LuxReactantExt/LuxReactantExt.jl @@ -2,7 +2,8 @@ module LuxReactantExt using Enzyme: Enzyme, Const using Optimisers: Optimisers -using Reactant: Reactant, @compile, @code_hlo, AnyTracedRArray, TracedRArray, TracedRNumber +using Reactant: + Reactant, @compile, @code_hlo, @jit, AnyTracedRArray, TracedRArray, TracedRNumber using ReactantCore: ReactantCore, @trace using Setfield: @set! using Static: True, False diff --git a/ext/LuxReactantExt/patches.jl b/ext/LuxReactantExt/patches.jl index bc9ad74b20..02154b0a2b 100644 --- a/ext/LuxReactantExt/patches.jl +++ b/ext/LuxReactantExt/patches.jl @@ -2,3 +2,8 @@ Utils.vec(x::AnyTracedRArray) = ReactantCore.materialize_traced_array(vec(x)) # XXX: Use PoolDims once EnzymeJAX supports stablehlo.reduce_window adjoint Lux.calculate_pool_dims(g::Lux.GlobalPoolMode, ::TracedRArray) = g + +# Optimisers setup +function Lux.Training.optimisers_setup_with_jit(opt, ps) + return @jit Optimisers.setup(opt, ps) +end diff --git a/src/helpers/optimizers.jl b/src/helpers/optimizers.jl index 69ebfc08a8..4ad6584830 100644 --- a/src/helpers/optimizers.jl +++ b/src/helpers/optimizers.jl @@ -2,162 +2,20 @@ # We can remove this once https://github.com/FluxML/Optimisers.jl/issues/205 is resolved. module ReactantCompatibleOptimisers -using ConcreteStructs: @concrete using Optimisers: Optimisers, AbstractRule -using Setfield: Setfield, @set! using ..Lux: Lux, Utils -abstract type ReactantCompatibleOptimisersRule <: AbstractRule end - -function make_reactant_compatible(opt::AbstractRule) - @warn "`make_reactant_compatible` is not defined for $(opt). Returning the original \ - optimizer. This means adjusting learning rate and other parameters won't \ - reflect in the generated MLIR." maxlog = 1 - return opt -end -make_reactant_compatible(opt::ReactantCompatibleOptimisersRule) = opt - -function setfield_if_present(opt, field::Symbol, nt::NamedTuple) - if hasfield(typeof(nt), field) - return Setfield.set( - opt, - Setfield.PropertyLens{field}(), - convert(typeof(getproperty(opt, field)), getproperty(nt, field)), - ) - end - return opt -end - -function Optimisers._adjust(opt::ReactantCompatibleOptimisersRule, nt::NamedTuple) - for field in fieldnames(typeof(opt)) - opt = setfield_if_present(opt, field, nt) - end - return opt -end - -# OptimiserChain function make_reactant_compatible(opt::Optimisers.OptimiserChain) - return Optimisers.OptimiserChain(make_reactant_compatible.(opt.opts)) -end - -# Descent -@concrete struct ReactantDescent <: ReactantCompatibleOptimisersRule - eta -end - -function make_reactant_compatible(opt::Optimisers.Descent) - return ReactantDescent(Utils.to_rarray(opt.eta; track_numbers=true)) -end - -Optimisers.init(::ReactantDescent, ::AbstractArray) = nothing - -function Optimisers.apply!(opt::ReactantDescent, state, x::AbstractArray{T}, dx) where {T} - η = T(opt.eta) - return state, @. dx * η -end - -# Momentum -@concrete struct ReactantMomentum <: ReactantCompatibleOptimisersRule - eta - rho -end - -function make_reactant_compatible(opt::Optimisers.Momentum) - return ReactantMomentum( - Utils.to_rarray(opt.eta; track_numbers=true), - Utils.to_rarray(opt.rho; track_numbers=true), - ) -end - -function Optimisers.init(::ReactantMomentum, x::AbstractArray) - return Optimisers.init(Optimisers.Momentum(0.0, 0.0), x) + return Optimisers.OptimiserChain(make_reactant_compatible.(opt.opts)...) end -function Optimisers.apply!(opt::ReactantMomentum, mvel, ::AbstractArray{T}, dx) where {T} - η, ρ = T(opt.eta), T(opt.rho) - @. mvel = ρ * mvel + η * dx - return mvel, mvel +function make_reactant_compatible(opt::Optimisers.AbstractRule) + return Utils.to_rarray(opt; track_numbers=AbstractFloat) end -# Adam -@concrete struct ReactantAdam <: ReactantCompatibleOptimisersRule - eta - beta - epsilon -end - -function make_reactant_compatible(opt::Optimisers.Adam) - return ReactantAdam( - Utils.to_rarray(opt.eta; track_numbers=true), - Utils.to_rarray(opt.beta; track_numbers=true), - Utils.to_rarray(opt.epsilon; track_numbers=true), - ) -end - -function Optimisers.init(opt::ReactantAdam, x::AbstractArray{T}) where {T} - return ( - zero(x), - zero(x), - (Utils.promote_to(T, opt.beta[1]), Utils.promote_to(T, opt.beta[2])), - ) -end - -function Optimisers.apply!(o::ReactantAdam, state, ::AbstractArray{T}, dx) where {T} - η, β, ϵ = T(o.eta), T.(o.beta), T(o.epsilon) # XXX: See Optimisers._eps - mt, vt, βt = state - - mt = @. β[1] * mt + (1 - β[1]) * dx - vt = @. β[2] * vt + (1 - β[2]) * abs2(dx) - dx′ = @. mt / (1 - βt[1]) / (sqrt(vt / (1 - βt[2])) + ϵ) * η - - return (mt, vt, βt .* β), dx′ -end - -# AdamW -@concrete struct ReactantAdamW <: ReactantCompatibleOptimisersRule - eta - beta - lambda - epsilon - couple::Bool -end - -function make_reactant_compatible(opt::Optimisers.AdamW) - return ReactantAdamW( - Utils.to_rarray(opt.eta; track_numbers=true), - Utils.to_rarray(opt.beta; track_numbers=true), - Utils.to_rarray(opt.lambda; track_numbers=true), - Utils.to_rarray(opt.epsilon; track_numbers=true), - opt.couple, - ) -end - -function Optimisers.init(opt::ReactantAdamW, x::AbstractArray{T}) where {T} - return ( - zero(x), - zero(x), - (Utils.promote_to(T, opt.beta[1]), Utils.promote_to(T, opt.beta[2])), - ) -end - -function Optimisers.apply!(o::ReactantAdamW, state, x::AbstractArray{T}, dx) where {T} - η, β, ϵ, λ = T(o.eta), T.(o.beta), T(o.epsilon), T(o.lambda) # XXX: See Optimisers._eps - mt, vt, βt = state - - # standard Adam update with learning rate eta=1 - mt = @. β[1] * mt + (1 - β[1]) * dx - vt = @. β[2] * vt + (1 - β[2]) * abs2(dx) - dx′ = @. mt / (1 - βt[1]) / (sqrt(vt / (1 - βt[2])) + ϵ) - - # apply learning rate and weight decay - if o.couple - dx′′ = @. η * (dx′ + λ * x) - else - dx′′ = @. η * dx′ + λ * x - end - - return (mt, vt, βt .* β), dx′′ +function make_reactant_compatible(opt::Optimisers.AccumGrad) + return Utils.to_rarray(opt; track_numbers=Integer) end end diff --git a/src/helpers/training.jl b/src/helpers/training.jl index 537547a594..c9542a1cff 100644 --- a/src/helpers/training.jl +++ b/src/helpers/training.jl @@ -63,14 +63,17 @@ Constructor for [`TrainState`](@ref). [`TrainState`](@ref) object. """ function TrainState(model::AbstractLuxLayer, ps, st, optimizer::Optimisers.AbstractRule) - st_opt = if get_device_type(ps) <: ReactantDevice - Optimisers.setup(ReactantCompatibleOptimisers.make_reactant_compatible(optimizer), ps) + if get_device_type(ps) <: ReactantDevice + optimizer = ReactantCompatibleOptimisers.make_reactant_compatible(optimizer) + st_opt = optimisers_setup_with_jit(optimizer, ps) else - Optimisers.setup(optimizer, ps) + st_opt = Optimisers.setup(optimizer, ps) end return TrainState(nothing, nothing, model, ps, st, optimizer, st_opt, 0) end +function optimisers_setup_with_jit end + @concrete struct TrainingBackendCache backend first_try <: StaticBool diff --git a/test/Project.toml b/test/Project.toml index cd3cc1cd27..380eede072 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -65,7 +65,7 @@ MLUtils = "0.4.3" NNlib = "0.9.26" Octavian = "0.3.28" OneHotArrays = "0.2.5" -Optimisers = "0.4.1" +Optimisers = "0.4.6" Pkg = "1.10" Preferences = "1.4.3" Random = "1.10" @@ -81,3 +81,6 @@ Statistics = "1.10" Test = "1.10" Tracker = "0.2.37" Zygote = "0.6.73, 0.7" + +[sources] +Optimisers = {url="https://github.com/avik-pal/Optimisers.jl", rev="ap/fix_check"} diff --git a/test/layers/embedding_tests.jl b/test/layers/embedding_tests.jl index e59ab70cb9..1aed1db311 100644 --- a/test/layers/embedding_tests.jl +++ b/test/layers/embedding_tests.jl @@ -116,7 +116,7 @@ end end end -@testitem "Reactant SinusoidalPositionalEmbedding" setup = [ +@testitem "Reactant: SinusoidalPositionalEmbedding" setup = [ SharedTestSetup, SharedReactantLayersTestSetup ] tags = [:reactant] begin using Reactant, Lux @@ -234,7 +234,7 @@ end end end -@testitem "Reactant RotaryPositionalEmbedding" setup = [ +@testitem "Reactant: RotaryPositionalEmbedding" setup = [ SharedTestSetup, SharedReactantLayersTestSetup ] tags = [:reactant] begin using Reactant, Lux diff --git a/test/reactant/training_tests.jl b/test/reactant/training_tests.jl index a869f0d108..00205f9016 100644 --- a/test/reactant/training_tests.jl +++ b/test/reactant/training_tests.jl @@ -47,8 +47,13 @@ inference_loss_fn_compiled(xᵢ, yᵢ, model, ps, st) end - @testset for opt in - (Descent(0.01f0), Momentum(0.01f0), Adam(0.01f0), AdamW(0.01f0)) + @testset for opt in ( + Descent(0.01f0), + Momentum(0.01f0), + Adam(0.01f0), + AdamW(0.01f0), + OptimiserChain(AccumGrad(5), Adam(0.01f0)), + ) train_state = Training.TrainState(model, ps, st, opt) for epoch in 1:100, (xᵢ, yᵢ) in dataloader @@ -76,3 +81,26 @@ end end end + +@testitem "Reactant Optimisers Patch: AccumGrad" tags = [:reactant] setup = [ + SharedTestSetup +] skip = :(Sys.iswindows()) begin + using Lux, Random, Reactant, Optimisers + + dev = reactant_device(; force=true) + + model = Chain( + Dense(2 => 4, relu), Chain(Dense(4 => 2, relu; use_bias=false), Dense(2 => 1)) + ) + ps, st = Lux.setup(Random.default_rng(), model) |> dev + + x = randn(Float32, 2, 32) |> dev + + train_state = Training.TrainState( + model, ps, st, OptimiserChain(AccumGrad(5), Descent(0.1)) + ) + st_opt = train_state.optimizer_state + + hlo = repr(@code_hlo(Optimisers.update(st_opt, ps, ps))) + @test length(findall("stablehlo.if", hlo)) == (2 + 1 + 2) * 2 +end From 6140235e1c1489c0183980aeb18aa2101036f50b Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Tue, 1 Apr 2025 19:04:30 -0400 Subject: [PATCH 2/6] ci: run all tests --- .github/workflows/CI.yml | 20 +- .github/workflows/CIPreRelease.yml | 10 +- .github/workflows/CI_LuxCUDA.yml | 150 +++++------ .github/workflows/CI_LuxCore.yml | 206 +++++++-------- .github/workflows/CI_LuxLib.yml | 278 ++++++++++---------- .github/workflows/CI_LuxTestUtils.yml | 164 ++++++------ .github/workflows/CI_MLDataDevices.yml | 186 ++++++------- .github/workflows/CI_WeightInitializers.yml | 164 ++++++------ Project.toml | 1 - 9 files changed, 589 insertions(+), 590 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4a56295cbd..b391fa66b6 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -37,11 +37,11 @@ jobs: os: - ubuntu-latest test_group: - # - "core_layers" - # - "normalize_layers" - # - "recurrent_layers" - # - "autodiff" - # - "misc" + - "core_layers" + - "normalize_layers" + - "recurrent_layers" + - "autodiff" + - "misc" - "reactant" steps: - uses: actions/checkout@v4 @@ -86,11 +86,11 @@ jobs: fail-fast: false matrix: test_group: - # - "core_layers" - # - "normalize_layers" - # - "recurrent_layers" - # - "autodiff" - # - "misc" + - "core_layers" + - "normalize_layers" + - "recurrent_layers" + - "autodiff" + - "misc" - "reactant" steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/CIPreRelease.yml b/.github/workflows/CIPreRelease.yml index da84bdeccc..52f237806a 100644 --- a/.github/workflows/CIPreRelease.yml +++ b/.github/workflows/CIPreRelease.yml @@ -36,11 +36,11 @@ jobs: os: - ubuntu-latest test_group: - # - "core_layers" - # - "normalize_layers" - # - "recurrent_layers" - # - "autodiff" - # - "misc" + - "core_layers" + - "normalize_layers" + - "recurrent_layers" + - "autodiff" + - "misc" - "reactant" steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/CI_LuxCUDA.yml b/.github/workflows/CI_LuxCUDA.yml index eefd973d5c..e310da1a30 100644 --- a/.github/workflows/CI_LuxCUDA.yml +++ b/.github/workflows/CI_LuxCUDA.yml @@ -1,79 +1,79 @@ -# name: CI (LuxCUDA) -# on: -# pull_request: -# branches: -# - main -# paths: -# - "lib/LuxCUDA/**" -# - ".github/workflows/CI_LuxCUDA.yml" -# push: -# branches: -# - main +name: CI (LuxCUDA) +on: + pull_request: + branches: + - main + paths: + - "lib/LuxCUDA/**" + - ".github/workflows/CI_LuxCUDA.yml" + push: + branches: + - main -# concurrency: -# # Skip intermediate builds: always. -# # Cancel intermediate builds: only if it is a pull request build. -# group: ${{ github.workflow }}-${{ github.ref }} -# cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} -# jobs: -# test: -# runs-on: ubuntu-latest -# strategy: -# fail-fast: false -# matrix: -# version: -# - "1" -# steps: -# - uses: actions/checkout@v4 -# - uses: julia-actions/setup-julia@v2 -# with: -# version: ${{ matrix.version }} -# - uses: julia-actions/cache@v2 -# - uses: julia-actions/julia-buildpkg@v1 -# with: -# project: "lib/LuxCUDA" -# - name: "Run Tests" -# run: | -# import Pkg -# Pkg.test(; coverage="user") -# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxCUDA {0} -# - uses: julia-actions/julia-processcoverage@v1 -# with: -# directories: lib/LuxCUDA/src -# - uses: codecov/codecov-action@v5 -# with: -# files: lcov.info -# token: ${{ secrets.CODECOV_TOKEN }} -# verbose: true -# fail_ci_if_error: false +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + version: + - "1" + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: ${{ matrix.version }} + - uses: julia-actions/cache@v2 + - uses: julia-actions/julia-buildpkg@v1 + with: + project: "lib/LuxCUDA" + - name: "Run Tests" + run: | + import Pkg + Pkg.test(; coverage="user") + shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxCUDA {0} + - uses: julia-actions/julia-processcoverage@v1 + with: + directories: lib/LuxCUDA/src + - uses: codecov/codecov-action@v5 + with: + files: lcov.info + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true + fail_ci_if_error: false -# downgrade: -# if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && github.base_ref == github.event.repository.default_branch }} -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v4 -# - uses: julia-actions/setup-julia@v2 -# with: -# version: "1.10" -# - uses: julia-actions/julia-downgrade-compat@v1 -# - uses: julia-actions/julia-buildpkg@v1 -# with: -# project: "lib/LuxCUDA" -# - name: "Run Tests" -# run: | -# import Pkg -# Pkg.test(; coverage="user") -# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxCUDA {0} -# - uses: julia-actions/julia-processcoverage@v1 -# with: -# directories: lib/LuxCUDA/src -# - uses: codecov/codecov-action@v5 -# with: -# files: lcov.info -# token: ${{ secrets.CODECOV_TOKEN }} -# verbose: true -# fail_ci_if_error: false + downgrade: + if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && github.base_ref == github.event.repository.default_branch }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: "1.10" + - uses: julia-actions/julia-downgrade-compat@v1 + - uses: julia-actions/julia-buildpkg@v1 + with: + project: "lib/LuxCUDA" + - name: "Run Tests" + run: | + import Pkg + Pkg.test(; coverage="user") + shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxCUDA {0} + - uses: julia-actions/julia-processcoverage@v1 + with: + directories: lib/LuxCUDA/src + - uses: codecov/codecov-action@v5 + with: + files: lcov.info + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true + fail_ci_if_error: false -# env: -# BACKEND_GROUP: "CPU" +env: + BACKEND_GROUP: "CPU" diff --git a/.github/workflows/CI_LuxCore.yml b/.github/workflows/CI_LuxCore.yml index 3a25131e87..bda2d79fc0 100644 --- a/.github/workflows/CI_LuxCore.yml +++ b/.github/workflows/CI_LuxCore.yml @@ -1,107 +1,107 @@ -# name: CI (LuxCore) -# on: -# pull_request: -# branches: -# - main -# paths: -# - "lib/LuxCore/**" -# - ".github/workflows/CI_LuxCore.yml" -# - "lib/MLDataDevices/**" -# push: -# branches: -# - main +name: CI (LuxCore) +on: + pull_request: + branches: + - main + paths: + - "lib/LuxCore/**" + - ".github/workflows/CI_LuxCore.yml" + - "lib/MLDataDevices/**" + push: + branches: + - main -# concurrency: -# # Skip intermediate builds: always. -# # Cancel intermediate builds: only if it is a pull request build. -# group: ${{ github.workflow }}-${{ github.ref }} -# cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} -# jobs: -# test: -# if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }} -# runs-on: ${{ matrix.os }} -# strategy: -# fail-fast: false -# matrix: -# version: -# - "1" -# os: -# - ubuntu-latest -# steps: -# - uses: actions/checkout@v4 -# - uses: julia-actions/setup-julia@v2 -# with: -# version: ${{ matrix.version }} -# - uses: julia-actions/cache@v2 -# - uses: julia-actions/julia-buildpkg@v1 -# with: -# project: "lib/LuxCore" -# - name: "Dev Test Dependencies" -# run: | -# import Pkg -# dev_pkgs = Pkg.PackageSpec[] -# for pkg in ("lib/LuxCore", "lib/MLDataDevices") -# push!(dev_pkgs, Pkg.PackageSpec(path=pkg)) -# end -# Pkg.develop(dev_pkgs) -# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxCore/test {0} -# - name: "Run Tests" -# run: | -# import Pkg, LuxCore -# dir = dirname(pathof(LuxCore)) -# include(joinpath(dir, "../test/runtests.jl")) -# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxCore/test {0} -# - uses: julia-actions/julia-processcoverage@v1 -# with: -# directories: lib/LuxCore/src,lib/LuxCore/ext,lib/MLDataDevices/src,lib/MLDataDevices/ext -# - uses: codecov/codecov-action@v5 -# with: -# files: lcov.info -# token: ${{ secrets.CODECOV_TOKEN }} -# verbose: true -# fail_ci_if_error: false +jobs: + test: + if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + version: + - "1" + os: + - ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: ${{ matrix.version }} + - uses: julia-actions/cache@v2 + - uses: julia-actions/julia-buildpkg@v1 + with: + project: "lib/LuxCore" + - name: "Dev Test Dependencies" + run: | + import Pkg + dev_pkgs = Pkg.PackageSpec[] + for pkg in ("lib/LuxCore", "lib/MLDataDevices") + push!(dev_pkgs, Pkg.PackageSpec(path=pkg)) + end + Pkg.develop(dev_pkgs) + shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxCore/test {0} + - name: "Run Tests" + run: | + import Pkg, LuxCore + dir = dirname(pathof(LuxCore)) + include(joinpath(dir, "../test/runtests.jl")) + shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxCore/test {0} + - uses: julia-actions/julia-processcoverage@v1 + with: + directories: lib/LuxCore/src,lib/LuxCore/ext,lib/MLDataDevices/src,lib/MLDataDevices/ext + - uses: codecov/codecov-action@v5 + with: + files: lcov.info + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true + fail_ci_if_error: false -# downgrade: -# if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && github.base_ref == github.event.repository.default_branch }} -# runs-on: ubuntu-latest -# strategy: -# fail-fast: false -# matrix: -# version: ["1.10"] -# steps: -# - uses: actions/checkout@v4 -# - uses: julia-actions/setup-julia@v2 -# with: -# version: ${{ matrix.version }} -# - uses: julia-actions/julia-downgrade-compat@v1 -# - uses: julia-actions/julia-buildpkg@v1 -# with: -# project: "lib/LuxCore" -# - name: "Dev Test Dependencies" -# run: | -# import Pkg -# dev_pkgs = Pkg.PackageSpec[] -# for pkg in ("lib/LuxCore", "lib/MLDataDevices") -# push!(dev_pkgs, Pkg.PackageSpec(path=pkg)) -# end -# Pkg.develop(dev_pkgs) -# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxCore/test {0} -# - name: "Run Tests" -# run: | -# import Pkg, LuxCore -# dir = dirname(pathof(LuxCore)) -# include(joinpath(dir, "../test/runtests.jl")) -# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxCore/test {0} -# - uses: julia-actions/julia-processcoverage@v1 -# with: -# directories: lib/LuxCore/src,lib/LuxCore/ext,lib/MLDataDevices/src,lib/MLDataDevices/ext -# - uses: codecov/codecov-action@v5 -# with: -# files: lcov.info -# token: ${{ secrets.CODECOV_TOKEN }} -# verbose: true -# fail_ci_if_error: false + downgrade: + if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && github.base_ref == github.event.repository.default_branch }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + version: ["1.10"] + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: ${{ matrix.version }} + - uses: julia-actions/julia-downgrade-compat@v1 + - uses: julia-actions/julia-buildpkg@v1 + with: + project: "lib/LuxCore" + - name: "Dev Test Dependencies" + run: | + import Pkg + dev_pkgs = Pkg.PackageSpec[] + for pkg in ("lib/LuxCore", "lib/MLDataDevices") + push!(dev_pkgs, Pkg.PackageSpec(path=pkg)) + end + Pkg.develop(dev_pkgs) + shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxCore/test {0} + - name: "Run Tests" + run: | + import Pkg, LuxCore + dir = dirname(pathof(LuxCore)) + include(joinpath(dir, "../test/runtests.jl")) + shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxCore/test {0} + - uses: julia-actions/julia-processcoverage@v1 + with: + directories: lib/LuxCore/src,lib/LuxCore/ext,lib/MLDataDevices/src,lib/MLDataDevices/ext + - uses: codecov/codecov-action@v5 + with: + files: lcov.info + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true + fail_ci_if_error: false -# env: -# BACKEND_GROUP: "CPU" +env: + BACKEND_GROUP: "CPU" diff --git a/.github/workflows/CI_LuxLib.yml b/.github/workflows/CI_LuxLib.yml index 1a01be1116..c13b5ee22b 100644 --- a/.github/workflows/CI_LuxLib.yml +++ b/.github/workflows/CI_LuxLib.yml @@ -1,143 +1,143 @@ -# name: CI (LuxLib) -# on: -# pull_request: -# branches: -# - main -# paths: -# - "lib/LuxLib/**" -# - ".github/workflows/CI_LuxLib.yml" -# - "lib/LuxTestUtils/**" -# - "lib/LuxCore/**" -# - "lib/MLDataDevices/**" -# push: -# branches: -# - main +name: CI (LuxLib) +on: + pull_request: + branches: + - main + paths: + - "lib/LuxLib/**" + - ".github/workflows/CI_LuxLib.yml" + - "lib/LuxTestUtils/**" + - "lib/LuxCore/**" + - "lib/MLDataDevices/**" + push: + branches: + - main -# concurrency: -# # Skip intermediate builds: always. -# # Cancel intermediate builds: only if it is a pull request build. -# group: ${{ github.workflow }}-${{ github.ref }} -# cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} -# jobs: -# test: -# if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }} -# runs-on: ${{ matrix.os }} -# strategy: -# fail-fast: false -# matrix: -# version: -# - "1" -# os: -# - ubuntu-latest -# test_group: -# - "conv" -# - "dense" -# - "normalization" -# - "misc" -# blas_backend: -# - "default" -# loopvec: -# - "true" -# include: -# - version: "1" -# os: ubuntu-latest -# test_group: "dense" -# blas_backend: "default" -# loopvec: "false" -# - version: "1" -# os: ubuntu-latest -# test_group: "misc" -# blas_backend: "default" -# loopvec: "false" -# steps: -# - uses: actions/checkout@v4 -# - uses: julia-actions/setup-julia@v2 -# with: -# version: ${{ matrix.version }} -# - uses: julia-actions/cache@v2 -# - uses: julia-actions/julia-buildpkg@v1 -# with: -# project: "lib/LuxLib" -# - name: "Dev Test Dependencies" -# run: | -# import Pkg -# dev_pkgs = Pkg.PackageSpec[] -# for pkg in ("lib/LuxTestUtils", "lib/LuxLib", "lib/MLDataDevices") -# push!(dev_pkgs, Pkg.PackageSpec(path=pkg)) -# end -# Pkg.develop(dev_pkgs) -# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxLib/test {0} -# - name: "Run Tests" -# run: | -# import Pkg, LuxLib -# dir = dirname(pathof(LuxLib)) -# include(joinpath(dir, "../test/runtests.jl")) -# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxLib/test {0} -# env: -# LUXLIB_TEST_GROUP: ${{ matrix.test_group }} -# LUXLIB_BLAS_BACKEND: ${{ matrix.blas_backend }} -# LUXLIB_LOAD_LOOPVEC: ${{ matrix.loopvec }} -# - uses: julia-actions/julia-processcoverage@v1 -# with: -# directories: lib/LuxLib/src,lib/LuxLib/ext,lib/LuxCore/src,lib/LuxCore/ext,lib/MLDataDevices/src,lib/MLDataDevices/ext,lib/LuxTestUtils/src -# - uses: codecov/codecov-action@v5 -# with: -# files: lcov.info -# token: ${{ secrets.CODECOV_TOKEN }} -# verbose: true -# fail_ci_if_error: false +jobs: + test: + if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + version: + - "1" + os: + - ubuntu-latest + test_group: + - "conv" + - "dense" + - "normalization" + - "misc" + blas_backend: + - "default" + loopvec: + - "true" + include: + - version: "1" + os: ubuntu-latest + test_group: "dense" + blas_backend: "default" + loopvec: "false" + - version: "1" + os: ubuntu-latest + test_group: "misc" + blas_backend: "default" + loopvec: "false" + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: ${{ matrix.version }} + - uses: julia-actions/cache@v2 + - uses: julia-actions/julia-buildpkg@v1 + with: + project: "lib/LuxLib" + - name: "Dev Test Dependencies" + run: | + import Pkg + dev_pkgs = Pkg.PackageSpec[] + for pkg in ("lib/LuxTestUtils", "lib/LuxLib", "lib/MLDataDevices") + push!(dev_pkgs, Pkg.PackageSpec(path=pkg)) + end + Pkg.develop(dev_pkgs) + shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxLib/test {0} + - name: "Run Tests" + run: | + import Pkg, LuxLib + dir = dirname(pathof(LuxLib)) + include(joinpath(dir, "../test/runtests.jl")) + shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxLib/test {0} + env: + LUXLIB_TEST_GROUP: ${{ matrix.test_group }} + LUXLIB_BLAS_BACKEND: ${{ matrix.blas_backend }} + LUXLIB_LOAD_LOOPVEC: ${{ matrix.loopvec }} + - uses: julia-actions/julia-processcoverage@v1 + with: + directories: lib/LuxLib/src,lib/LuxLib/ext,lib/LuxCore/src,lib/LuxCore/ext,lib/MLDataDevices/src,lib/MLDataDevices/ext,lib/LuxTestUtils/src + - uses: codecov/codecov-action@v5 + with: + files: lcov.info + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true + fail_ci_if_error: false -# downgrade: -# if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && github.base_ref == github.event.repository.default_branch }} -# runs-on: ubuntu-latest -# strategy: -# fail-fast: false -# matrix: -# test_group: -# - "conv" -# - "dense" -# - "normalization" -# - "misc" -# steps: -# - uses: actions/checkout@v4 -# - uses: julia-actions/setup-julia@v2 -# with: -# version: "1.10" -# - uses: julia-actions/julia-downgrade-compat@v1 -# with: -# skip: "LuxCore,MLDataDevices" -# - uses: julia-actions/julia-buildpkg@v1 -# with: -# project: "lib/LuxLib" -# - name: "Dev Test Dependencies" -# run: | -# import Pkg -# dev_pkgs = Pkg.PackageSpec[] -# for pkg in ("lib/LuxTestUtils", "lib/LuxLib", "lib/MLDataDevices") -# push!(dev_pkgs, Pkg.PackageSpec(path=pkg)) -# end -# Pkg.develop(dev_pkgs) -# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxLib/test {0} -# - name: "Run Tests" -# run: | -# import Pkg, LuxLib -# dir = dirname(pathof(LuxLib)) -# include(joinpath(dir, "../test/runtests.jl")) -# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxLib/test {0} -# env: -# LUXLIB_TEST_GROUP: ${{ matrix.test_group }} -# LUXLIB_BLAS_BACKEND: "default" -# LUXLIB_LOAD_LOOPVEC: "true" -# - uses: julia-actions/julia-processcoverage@v1 -# with: -# directories: lib/LuxLib/src,lib/LuxLib/ext,lib/LuxCore/src,lib/LuxCore/ext,lib/MLDataDevices/src,lib/MLDataDevices/ext,lib/LuxTestUtils/src -# - uses: codecov/codecov-action@v5 -# with: -# files: lcov.info -# token: ${{ secrets.CODECOV_TOKEN }} -# verbose: true -# fail_ci_if_error: false + downgrade: + if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && github.base_ref == github.event.repository.default_branch }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + test_group: + - "conv" + - "dense" + - "normalization" + - "misc" + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: "1.10" + - uses: julia-actions/julia-downgrade-compat@v1 + with: + skip: "LuxCore,MLDataDevices" + - uses: julia-actions/julia-buildpkg@v1 + with: + project: "lib/LuxLib" + - name: "Dev Test Dependencies" + run: | + import Pkg + dev_pkgs = Pkg.PackageSpec[] + for pkg in ("lib/LuxTestUtils", "lib/LuxLib", "lib/MLDataDevices") + push!(dev_pkgs, Pkg.PackageSpec(path=pkg)) + end + Pkg.develop(dev_pkgs) + shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxLib/test {0} + - name: "Run Tests" + run: | + import Pkg, LuxLib + dir = dirname(pathof(LuxLib)) + include(joinpath(dir, "../test/runtests.jl")) + shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxLib/test {0} + env: + LUXLIB_TEST_GROUP: ${{ matrix.test_group }} + LUXLIB_BLAS_BACKEND: "default" + LUXLIB_LOAD_LOOPVEC: "true" + - uses: julia-actions/julia-processcoverage@v1 + with: + directories: lib/LuxLib/src,lib/LuxLib/ext,lib/LuxCore/src,lib/LuxCore/ext,lib/MLDataDevices/src,lib/MLDataDevices/ext,lib/LuxTestUtils/src + - uses: codecov/codecov-action@v5 + with: + files: lcov.info + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true + fail_ci_if_error: false -# env: -# BACKEND_GROUP: "CPU" +env: + BACKEND_GROUP: "CPU" diff --git a/.github/workflows/CI_LuxTestUtils.yml b/.github/workflows/CI_LuxTestUtils.yml index f8fb03de32..2d9c30f391 100644 --- a/.github/workflows/CI_LuxTestUtils.yml +++ b/.github/workflows/CI_LuxTestUtils.yml @@ -1,86 +1,86 @@ -# name: CI (LuxTestUtils) -# on: -# pull_request: -# branches: -# - main -# paths: -# - "lib/LuxTestUtils/**" -# - ".github/workflows/CI_LuxTestUtils.yml" -# push: -# branches: -# - main +name: CI (LuxTestUtils) +on: + pull_request: + branches: + - main + paths: + - "lib/LuxTestUtils/**" + - ".github/workflows/CI_LuxTestUtils.yml" + push: + branches: + - main -# concurrency: -# # Skip intermediate builds: always. -# # Cancel intermediate builds: only if it is a pull request build. -# group: ${{ github.workflow }}-${{ github.ref }} -# cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} -# jobs: -# test: -# if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }} -# runs-on: ${{ matrix.os }} -# strategy: -# fail-fast: false -# matrix: -# version: -# - "1" -# os: -# - ubuntu-latest -# steps: -# - uses: actions/checkout@v4 -# - uses: julia-actions/setup-julia@v2 -# with: -# version: ${{ matrix.version }} -# - uses: julia-actions/cache@v2 -# - uses: julia-actions/julia-buildpkg@v1 -# with: -# project: "lib/LuxTestUtils" -# - name: "Run Tests" -# run: | -# import Pkg -# Pkg.test(; coverage="user") -# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxTestUtils {0} -# - uses: julia-actions/julia-processcoverage@v1 -# with: -# directories: lib/LuxTestUtils/src,lib/MLDataDevices/src,lib/MLDataDevices/ext -# - uses: codecov/codecov-action@v5 -# with: -# files: lcov.info -# token: ${{ secrets.CODECOV_TOKEN }} -# verbose: true -# fail_ci_if_error: false +jobs: + test: + if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + version: + - "1" + os: + - ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: ${{ matrix.version }} + - uses: julia-actions/cache@v2 + - uses: julia-actions/julia-buildpkg@v1 + with: + project: "lib/LuxTestUtils" + - name: "Run Tests" + run: | + import Pkg + Pkg.test(; coverage="user") + shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxTestUtils {0} + - uses: julia-actions/julia-processcoverage@v1 + with: + directories: lib/LuxTestUtils/src,lib/MLDataDevices/src,lib/MLDataDevices/ext + - uses: codecov/codecov-action@v5 + with: + files: lcov.info + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true + fail_ci_if_error: false -# downgrade: -# if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && github.base_ref == github.event.repository.default_branch }} -# runs-on: ubuntu-latest -# strategy: -# fail-fast: false -# matrix: -# version: ["1.10"] -# steps: -# - uses: actions/checkout@v4 -# - uses: julia-actions/setup-julia@v2 -# with: -# version: ${{ matrix.version }} -# - uses: julia-actions/julia-downgrade-compat@v1 -# - uses: julia-actions/julia-buildpkg@v1 -# with: -# project: "lib/LuxTestUtils" -# - name: "Run Tests" -# run: | -# import Pkg -# Pkg.test(; coverage="user") -# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxTestUtils {0} -# - uses: julia-actions/julia-processcoverage@v1 -# with: -# directories: lib/LuxTestUtils/src -# - uses: codecov/codecov-action@v5 -# with: -# files: lcov.info -# token: ${{ secrets.CODECOV_TOKEN }} -# verbose: true -# fail_ci_if_error: false + downgrade: + if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && github.base_ref == github.event.repository.default_branch }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + version: ["1.10"] + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: ${{ matrix.version }} + - uses: julia-actions/julia-downgrade-compat@v1 + - uses: julia-actions/julia-buildpkg@v1 + with: + project: "lib/LuxTestUtils" + - name: "Run Tests" + run: | + import Pkg + Pkg.test(; coverage="user") + shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/LuxTestUtils {0} + - uses: julia-actions/julia-processcoverage@v1 + with: + directories: lib/LuxTestUtils/src + - uses: codecov/codecov-action@v5 + with: + files: lcov.info + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true + fail_ci_if_error: false -# env: -# BACKEND_GROUP: "CPU" +env: + BACKEND_GROUP: "CPU" diff --git a/.github/workflows/CI_MLDataDevices.yml b/.github/workflows/CI_MLDataDevices.yml index 9e482f7363..ba60a0ed0c 100644 --- a/.github/workflows/CI_MLDataDevices.yml +++ b/.github/workflows/CI_MLDataDevices.yml @@ -1,97 +1,97 @@ -# name: CI (MLDataDevices) -# on: -# pull_request: -# branches: -# - main -# paths: -# - "lib/MLDataDevices/**" -# - ".github/workflows/CI_MLDataDevices.yml" -# push: -# branches: -# - main +name: CI (MLDataDevices) +on: + pull_request: + branches: + - main + paths: + - "lib/MLDataDevices/**" + - ".github/workflows/CI_MLDataDevices.yml" + push: + branches: + - main -# concurrency: -# # Skip intermediate builds: always. -# # Cancel intermediate builds: only if it is a pull request build. -# group: ${{ github.workflow }}-${{ github.ref }} -# cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} -# jobs: -# test: -# if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }} -# runs-on: ${{ matrix.os }} -# strategy: -# fail-fast: false -# matrix: -# version: -# - "1" -# os: -# - ubuntu-latest -# - macos-latest -# - windows-latest -# group: -# - CPU -# - XLA -# exclude: -# - os: windows-latest -# group: XLA -# steps: -# - uses: actions/checkout@v4 -# - uses: julia-actions/setup-julia@v2 -# with: -# version: ${{ matrix.version }} -# - uses: julia-actions/cache@v2 -# - uses: julia-actions/julia-buildpkg@v1 -# with: -# project: "lib/MLDataDevices" -# - name: "Run Tests" -# run: | -# import Pkg -# Pkg.test(; coverage="user") -# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/MLDataDevices {0} -# env: -# BACKEND_GROUP: ${{ matrix.group }} -# - uses: julia-actions/julia-processcoverage@v1 -# with: -# directories: lib/MLDataDevices/src,lib/MLDataDevices/ext -# - uses: codecov/codecov-action@v5 -# with: -# files: lcov.info -# token: ${{ secrets.CODECOV_TOKEN }} -# verbose: true -# fail_ci_if_error: false +jobs: + test: + if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + version: + - "1" + os: + - ubuntu-latest + - macos-latest + - windows-latest + group: + - CPU + - XLA + exclude: + - os: windows-latest + group: XLA + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: ${{ matrix.version }} + - uses: julia-actions/cache@v2 + - uses: julia-actions/julia-buildpkg@v1 + with: + project: "lib/MLDataDevices" + - name: "Run Tests" + run: | + import Pkg + Pkg.test(; coverage="user") + shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/MLDataDevices {0} + env: + BACKEND_GROUP: ${{ matrix.group }} + - uses: julia-actions/julia-processcoverage@v1 + with: + directories: lib/MLDataDevices/src,lib/MLDataDevices/ext + - uses: codecov/codecov-action@v5 + with: + files: lcov.info + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true + fail_ci_if_error: false -# downgrade: -# if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && github.base_ref == github.event.repository.default_branch }} -# runs-on: ubuntu-latest -# strategy: -# fail-fast: false -# matrix: -# version: -# - "1.10" -# steps: -# - uses: actions/checkout@v4 -# - uses: julia-actions/setup-julia@v2 -# with: -# version: ${{ matrix.version }} -# - uses: julia-actions/julia-downgrade-compat@v1 -# - uses: julia-actions/julia-buildpkg@v1 -# with: -# project: "lib/MLDataDevices" -# - name: "Run Tests" -# run: | -# import Pkg -# Pkg.test(; coverage="user") -# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/MLDataDevices {0} -# - uses: julia-actions/julia-processcoverage@v1 -# with: -# directories: lib/MLDataDevices/src,lib/MLDataDevices/ext -# - uses: codecov/codecov-action@v5 -# with: -# files: lcov.info -# token: ${{ secrets.CODECOV_TOKEN }} -# verbose: true -# fail_ci_if_error: false + downgrade: + if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && github.base_ref == github.event.repository.default_branch }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + version: + - "1.10" + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: ${{ matrix.version }} + - uses: julia-actions/julia-downgrade-compat@v1 + - uses: julia-actions/julia-buildpkg@v1 + with: + project: "lib/MLDataDevices" + - name: "Run Tests" + run: | + import Pkg + Pkg.test(; coverage="user") + shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/MLDataDevices {0} + - uses: julia-actions/julia-processcoverage@v1 + with: + directories: lib/MLDataDevices/src,lib/MLDataDevices/ext + - uses: codecov/codecov-action@v5 + with: + files: lcov.info + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true + fail_ci_if_error: false -# env: -# BACKEND_GROUP: "CPU" +env: + BACKEND_GROUP: "CPU" diff --git a/.github/workflows/CI_WeightInitializers.yml b/.github/workflows/CI_WeightInitializers.yml index a1f51804fd..5d1c4dab86 100644 --- a/.github/workflows/CI_WeightInitializers.yml +++ b/.github/workflows/CI_WeightInitializers.yml @@ -1,86 +1,86 @@ -# name: CI (WeightInitializers) -# on: -# pull_request: -# branches: -# - main -# paths: -# - "lib/WeightInitializers/**" -# - ".github/workflows/CI_WeightInitializers.yml" -# push: -# branches: -# - main +name: CI (WeightInitializers) +on: + pull_request: + branches: + - main + paths: + - "lib/WeightInitializers/**" + - ".github/workflows/CI_WeightInitializers.yml" + push: + branches: + - main -# concurrency: -# # Skip intermediate builds: always. -# # Cancel intermediate builds: only if it is a pull request build. -# group: ${{ github.workflow }}-${{ github.ref }} -# cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} -# jobs: -# test: -# if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }} -# runs-on: ${{ matrix.os }} -# strategy: -# fail-fast: false -# matrix: -# version: -# - "1" -# os: -# - ubuntu-latest -# steps: -# - uses: actions/checkout@v4 -# - uses: julia-actions/setup-julia@v2 -# with: -# version: ${{ matrix.version }} -# - uses: julia-actions/cache@v2 -# - uses: julia-actions/julia-buildpkg@v1 -# with: -# project: "lib/WeightInitializers" -# - name: "Run Tests" -# run: | -# import Pkg -# Pkg.test(; coverage="user") -# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/WeightInitializers {0} -# - uses: julia-actions/julia-processcoverage@v1 -# with: -# directories: lib/WeightInitializers/src,lib/WeightInitializers/ext -# - uses: codecov/codecov-action@v5 -# with: -# files: lcov.info -# token: ${{ secrets.CODECOV_TOKEN }} -# verbose: true -# fail_ci_if_error: false +jobs: + test: + if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + version: + - "1" + os: + - ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: ${{ matrix.version }} + - uses: julia-actions/cache@v2 + - uses: julia-actions/julia-buildpkg@v1 + with: + project: "lib/WeightInitializers" + - name: "Run Tests" + run: | + import Pkg + Pkg.test(; coverage="user") + shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/WeightInitializers {0} + - uses: julia-actions/julia-processcoverage@v1 + with: + directories: lib/WeightInitializers/src,lib/WeightInitializers/ext + - uses: codecov/codecov-action@v5 + with: + files: lcov.info + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true + fail_ci_if_error: false -# downgrade: -# if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && github.base_ref == github.event.repository.default_branch }} -# runs-on: ubuntu-latest -# strategy: -# fail-fast: false -# matrix: -# version: ["1.10"] -# steps: -# - uses: actions/checkout@v4 -# - uses: julia-actions/setup-julia@v2 -# with: -# version: ${{ matrix.version }} -# - uses: julia-actions/julia-downgrade-compat@v1 -# - uses: julia-actions/julia-buildpkg@v1 -# with: -# project: "lib/WeightInitializers" -# - name: "Run Tests" -# run: | -# import Pkg -# Pkg.test(; coverage="user") -# shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/WeightInitializers {0} -# - uses: julia-actions/julia-processcoverage@v1 -# with: -# directories: lib/WeightInitializers/src,lib/WeightInitializers/ext -# - uses: codecov/codecov-action@v5 -# with: -# files: lcov.info -# token: ${{ secrets.CODECOV_TOKEN }} -# verbose: true -# fail_ci_if_error: false + downgrade: + if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && github.base_ref == github.event.repository.default_branch }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + version: ["1.10"] + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: ${{ matrix.version }} + - uses: julia-actions/julia-downgrade-compat@v1 + - uses: julia-actions/julia-buildpkg@v1 + with: + project: "lib/WeightInitializers" + - name: "Run Tests" + run: | + import Pkg + Pkg.test(; coverage="user") + shell: julia --color=yes --code-coverage=user --depwarn=yes --project=lib/WeightInitializers {0} + - uses: julia-actions/julia-processcoverage@v1 + with: + directories: lib/WeightInitializers/src,lib/WeightInitializers/ext + - uses: codecov/codecov-action@v5 + with: + files: lcov.info + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true + fail_ci_if_error: false -# env: -# BACKEND_GROUP: "CPU" +env: + BACKEND_GROUP: "CPU" diff --git a/Project.toml b/Project.toml index a71502dd76..d265515a45 100644 --- a/Project.toml +++ b/Project.toml @@ -58,7 +58,6 @@ LuxCore = {path = "lib/LuxCore"} LuxLib = {path = "lib/LuxLib"} MLDataDevices = {path = "lib/MLDataDevices"} WeightInitializers = {path = "lib/WeightInitializers"} -Optimisers = {url="https://github.com/avik-pal/Optimisers.jl", rev="ap/fix_check"} [extensions] LuxComponentArraysExt = "ComponentArrays" From 76ff60e5121789fb9d9f5d9fb402aa007a22e74c Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Tue, 1 Apr 2025 19:06:18 -0400 Subject: [PATCH 3/6] fix: remove branch --- test/Project.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/Project.toml b/test/Project.toml index 380eede072..d95dff6dcf 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -81,6 +81,3 @@ Statistics = "1.10" Test = "1.10" Tracker = "0.2.37" Zygote = "0.6.73, 0.7" - -[sources] -Optimisers = {url="https://github.com/avik-pal/Optimisers.jl", rev="ap/fix_check"} From dddcb28310b3061b468582a51558d77a6e29fd82 Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Tue, 1 Apr 2025 20:00:17 -0400 Subject: [PATCH 4/6] fix: qa tests --- src/helpers/optimizers.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/optimizers.jl b/src/helpers/optimizers.jl index 4ad6584830..9b27a9774f 100644 --- a/src/helpers/optimizers.jl +++ b/src/helpers/optimizers.jl @@ -2,7 +2,7 @@ # We can remove this once https://github.com/FluxML/Optimisers.jl/issues/205 is resolved. module ReactantCompatibleOptimisers -using Optimisers: Optimisers, AbstractRule +using Optimisers: Optimisers using ..Lux: Lux, Utils From f7101daf07ff64d56b388be28735201fa212a4ac Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Tue, 1 Apr 2025 20:03:07 -0400 Subject: [PATCH 5/6] chore: update comment --- src/helpers/optimizers.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/helpers/optimizers.jl b/src/helpers/optimizers.jl index 9b27a9774f..414df1d7d7 100644 --- a/src/helpers/optimizers.jl +++ b/src/helpers/optimizers.jl @@ -1,5 +1,5 @@ -# This is mostly an internal implementation detail that users shouldn't need to worry about. -# We can remove this once https://github.com/FluxML/Optimisers.jl/issues/205 is resolved. +# We use this module mostly as a placeholder for patches that should be merged into +# Optimisers.jl for Reactant compatibility. module ReactantCompatibleOptimisers using Optimisers: Optimisers From 6b26d4c5ad46d617097741ff689d1a7068058cbc Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Tue, 1 Apr 2025 20:03:54 -0400 Subject: [PATCH 6/6] fix: module --- ext/LuxReactantExt/patches.jl | 2 +- src/helpers/optimizers.jl | 2 ++ src/helpers/training.jl | 4 +--- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/LuxReactantExt/patches.jl b/ext/LuxReactantExt/patches.jl index 02154b0a2b..6e94499fe8 100644 --- a/ext/LuxReactantExt/patches.jl +++ b/ext/LuxReactantExt/patches.jl @@ -4,6 +4,6 @@ Utils.vec(x::AnyTracedRArray) = ReactantCore.materialize_traced_array(vec(x)) Lux.calculate_pool_dims(g::Lux.GlobalPoolMode, ::TracedRArray) = g # Optimisers setup -function Lux.Training.optimisers_setup_with_jit(opt, ps) +function Lux.ReactantCompatibleOptimisers.optimisers_setup_with_jit(opt, ps) return @jit Optimisers.setup(opt, ps) end diff --git a/src/helpers/optimizers.jl b/src/helpers/optimizers.jl index 414df1d7d7..9fb837b3d8 100644 --- a/src/helpers/optimizers.jl +++ b/src/helpers/optimizers.jl @@ -18,4 +18,6 @@ function make_reactant_compatible(opt::Optimisers.AccumGrad) return Utils.to_rarray(opt; track_numbers=Integer) end +function optimisers_setup_with_jit end + end diff --git a/src/helpers/training.jl b/src/helpers/training.jl index c9542a1cff..332a9b0abd 100644 --- a/src/helpers/training.jl +++ b/src/helpers/training.jl @@ -65,15 +65,13 @@ Constructor for [`TrainState`](@ref). function TrainState(model::AbstractLuxLayer, ps, st, optimizer::Optimisers.AbstractRule) if get_device_type(ps) <: ReactantDevice optimizer = ReactantCompatibleOptimisers.make_reactant_compatible(optimizer) - st_opt = optimisers_setup_with_jit(optimizer, ps) + st_opt = ReactantCompatibleOptimisers.optimisers_setup_with_jit(optimizer, ps) else st_opt = Optimisers.setup(optimizer, ps) end return TrainState(nothing, nothing, model, ps, st, optimizer, st_opt, 0) end -function optimisers_setup_with_jit end - @concrete struct TrainingBackendCache backend first_try <: StaticBool