diff --git a/.github/workflows/combine-dependabot-prs.yml b/.github/workflows/combine-dependabot-prs.yml deleted file mode 100644 index cd46620ec8..0000000000 --- a/.github/workflows/combine-dependabot-prs.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Combine Dependabot PRs - -on: - schedule: - - cron: '0 6 * * MON' # Monday at 6:00am UTC - workflow_dispatch: # allows to manually trigger the workflow as well - -# The minimum permissions required to run this Action -permissions: - contents: write - pull-requests: write - checks: read - -jobs: - combine-prs: - runs-on: ubuntu-latest - - steps: - - name: combine-prs - id: combine-prs - uses: github/combine-prs@v5.0.0 # where X.X.X is the latest version - with: - labels: dependencies,automated diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml deleted file mode 100644 index 53cb5f49b3..0000000000 --- a/.github/workflows/dependencies.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: dependencies - -on: - schedule: - - cron: '0 21 * * TUE' # Run every Tuesday at 21:00 (UTC) - push: - tags: - - 'v*.*.*' # Run when a new version is being published - -env: - # - # Dependency versioning - # - - # Udeps version - UDEPS_VERSION: "0.1.147" - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - dependencies: - runs-on: ubuntu-latest - - steps: - - - name: checkout - uses: actions/checkout@v4.1.5 - - - name: Audit Rust dependencies - # If a vulnerability is found, a new issue will automatically be opened - # since this action runs on main branch - uses: actions-rust-lang/audit@v1 - - - name: Detect multiple versions of the same crate - uses: EmbarkStudios/cargo-deny-action@v1 - with: - command: check bans licenses sources - - - name: Install Rust nightly - uses: dtolnay/rust-toolchain@nightly - with: - toolchain: nightly - components: rustfmt - - - name: Install cargo-udeps - env: - UDEPS_LINK: https://github.com/est31/cargo-udeps/releases/download - run: | - curl -L "$UDEPS_LINK/v$UDEPS_VERSION/cargo-udeps-v$UDEPS_VERSION-x86_64-unknown-linux-gnu.tar.gz" | - tar xz -C $HOME/.cargo/bin --strip-components 2 - - - name: Run cargo-udeps - run: | - cargo +nightly udeps --all-targets diff --git a/.github/workflows/publish-template.yml b/.github/workflows/publish-template.yml deleted file mode 100644 index 3a540bab79..0000000000 --- a/.github/workflows/publish-template.yml +++ /dev/null @@ -1,24 +0,0 @@ -on: - workflow_call: - inputs: - crate: - required: true - type: string - secrets: - CRATES_IO_API_TOKEN: - required: true - -jobs: - publish-crate: - runs-on: ubuntu-latest - steps: - - name: checkout - uses: actions/checkout@v4.1.5 - - - name: install rust - uses: dtolnay/rust-toolchain@stable - - - name: publish to crates.io - run: cargo xtask publish ${{ inputs.crate }} - env: - CRATES_IO_API_TOKEN: ${{ secrets.CRATES_IO_API_TOKEN }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 0d8b36ef81..0000000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,163 +0,0 @@ -name: publish - -on: - push: - tags: - - "v*" - -jobs: - publish-burn-derive: - uses: tracel-ai/burn/.github/workflows/publish-template.yml@main - with: - crate: burn-derive - secrets: inherit - - publish-burn-dataset: - uses: tracel-ai/burn/.github/workflows/publish-template.yml@main - with: - crate: burn-dataset - needs: - - publish-burn-common - secrets: inherit - - publish-burn-common: - uses: tracel-ai/burn/.github/workflows/publish-template.yml@main - with: - crate: burn-common - secrets: inherit - - publish-burn-compute: - uses: tracel-ai/burn/.github/workflows/publish-template.yml@main - needs: - - publish-burn-common - with: - crate: burn-compute - secrets: inherit - - publish-burn-tensor-testgen: - uses: tracel-ai/burn/.github/workflows/publish-template.yml@main - with: - crate: burn-tensor-testgen - secrets: inherit - - publish-burn-tensor: - uses: tracel-ai/burn/.github/workflows/publish-template.yml@main - needs: - - publish-burn-tensor-testgen - - publish-burn-common - with: - crate: burn-tensor - secrets: inherit - - publish-burn-fusion: - uses: tracel-ai/burn/.github/workflows/publish-template.yml@main - needs: - - publish-burn-tensor - - publish-burn-common - with: - crate: burn-fusion - secrets: inherit - - publish-burn-jit: - uses: tracel-ai/burn/.github/workflows/publish-template.yml@main - needs: - - publish-burn-common - - publish-burn-fusion - - publish-burn-tensor - - publish-burn-ndarray - with: - crate: burn-jit - secrets: inherit - - publish-burn-autodiff: - uses: tracel-ai/burn/.github/workflows/publish-template.yml@main - needs: - - publish-burn-tensor - - publish-burn-tensor-testgen - - publish-burn-common - with: - crate: burn-autodiff - secrets: inherit - - publish-burn-tch: - uses: tracel-ai/burn/.github/workflows/publish-template.yml@main - needs: - - publish-burn-tensor - - publish-burn-autodiff - with: - crate: burn-tch - secrets: inherit - - publish-burn-ndarray: - uses: tracel-ai/burn/.github/workflows/publish-template.yml@main - needs: - - publish-burn-tensor - - publish-burn-autodiff - - publish-burn-common - with: - crate: burn-ndarray - secrets: inherit - - publish-burn-wgpu: - uses: tracel-ai/burn/.github/workflows/publish-template.yml@main - needs: - - publish-burn-tensor - - publish-burn-compute - - publish-burn-autodiff - - publish-burn-ndarray - - publish-burn-common - - publish-burn-jit - with: - crate: burn-wgpu - secrets: inherit - - publish-burn-candle: - uses: tracel-ai/burn/.github/workflows/publish-template.yml@main - needs: - - publish-burn-tensor - - publish-burn-autodiff - - publish-burn-tch - with: - crate: burn-candle - secrets: inherit - - publish-burn-core: - uses: tracel-ai/burn/.github/workflows/publish-template.yml@main - needs: - - publish-burn-dataset - - publish-burn-common - - publish-burn-derive - - publish-burn-tensor - - publish-burn-autodiff - - publish-burn-wgpu - - publish-burn-tch - - publish-burn-ndarray - - publish-burn-candle - with: - crate: burn-core - secrets: inherit - - publish-burn-train: - uses: tracel-ai/burn/.github/workflows/publish-template.yml@main - needs: - - publish-burn-core - with: - crate: burn-train - secrets: inherit - - publish-burn: - uses: tracel-ai/burn/.github/workflows/publish-template.yml@main - needs: - - publish-burn-core - - publish-burn-train - with: - crate: burn - secrets: inherit - - publish-burn-import: - uses: tracel-ai/burn/.github/workflows/publish-template.yml@main - needs: - - publish-burn - with: - crate: burn-import - secrets: inherit diff --git a/.github/workflows/semver-checks.yml b/.github/workflows/semver-checks.yml deleted file mode 100644 index cc35b387d1..0000000000 --- a/.github/workflows/semver-checks.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: semver-checks - -on: - schedule: - - cron: '0 21 * * THU' # Run every Thursday at 21:00 (UTC) - push: - tags: - - 'v*.*.*' # Run when a new version is being published - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - semver-checks: - runs-on: ubuntu-latest - - steps: - - name: checkout - uses: actions/checkout@v4.1.5 - - - name: Check semantic versioning violations - uses: obi1kenobi/cargo-semver-checks-action@v2.3 - with: - # cargo-semver-checks uses `all-features` by default, but `burn` - # publishes on crates.io with `default-features` - feature-group: default-features - # Exclude crates which are not published on crates.io - exclude: backend-comparison,burn-no-std-tests,onnx-tests,pytorch-tests diff --git a/.github/workflows/stale-pr.yml b/.github/workflows/stale-pr.yml deleted file mode 100644 index af2baf926d..0000000000 --- a/.github/workflows/stale-pr.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Stale Pull Requests - -on: - schedule: - - cron: '0 12 * * *' # Run every day at 12:00 (UTC) - -# The minimum permissions required to run this Action -permissions: - contents: write # only for delete-branch option - issues: write - pull-requests: write - -jobs: - stale-pr: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Stale pull requests - uses: actions/stale@v9 - with: - # The idle number of days before marking issues stale. - # - # With a negative number like -1, no issues - # will be marked as stale automatically. - days-before-issue-stale: -1 - # The idle number of days before marking pull requests stale - days-before-pr-stale: 30 - # The idle number of days before closing - # the stale pull requests (due to the stale label). - # - # With a negative number like -1, the pull requests - # will never be closed automatically. - days-before-pr-close: -1 - # Label to apply on staled pull requests - stale-pr-label: 'stale' - # The message that will be added as a comment to the pull request - stale-pr-message: 'This PR has been marked as stale because it has not been updated for over a month' - # Remove `stale` label from pull requests on updates/comments - remove-pr-stale-when-updated: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8bad6b9503..cd7d6c559d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -65,22 +65,15 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [blaze/macos-14, ubuntu-22.04, windows-2022] + os: [windows-2022] # We support both the latest Rust toolchain and the preceding version. rust: [stable, 1.78.0] - test: ['std', 'no-std', 'examples'] + test: ['std'] include: - cache: stable rust: stable - cache: 1-78-0 rust: 1.78.0 - - os: ubuntu-22.04 - coverage-flags: COVERAGE=1 - rust: stable - test: std - - os: blaze/macos-14 - rust: stable - test: std - os: windows-2022 wgpu-flags: "DISABLE_WGPU=1" # not used yet, as wgpu tests are disabled on windows for now diff --git a/.github/workflows/update-cargo-lock.yml b/.github/workflows/update-cargo-lock.yml deleted file mode 100644 index 7edcf60f34..0000000000 --- a/.github/workflows/update-cargo-lock.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Update Cargo.lock Pull Request -on: - schedule: - - cron: '0 6 * * TUE,WED,THU,FRI,SAT,SUN' # every day except Monday (reserved for dependabot) - workflow_dispatch: # allows to manually trigger the workflow as well - -jobs: - update-cargo-lock-file: - name: Update Cargo.lock file - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.1.5 - - uses: actions-rs/toolchain@v1.0.6 - with: - toolchain: stable - # we use a GitHub app token so that other workflows can react to the - # creation of the Pull Request. - # Following these guidelines -> https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#authenticating-with-github-app-generated-tokens - # For additional info -> https://github.com/actions/create-github-app-token - - name: generate GitHub app token - id: generate-app-token - uses: actions/create-github-app-token@v1.10.0 - with: - app-id: ${{ secrets.UPDATE_CARGO_LOCK_APP_ID }} - private-key: ${{ secrets.UPDATE_CARGO_LOCK_APP_PRIVATE_KEY }} - - name: cargo update - run: cargo update - - name: create pull request - uses: peter-evans/create-pull-request@v6 - with: - token: ${{ steps.generate-app-token.outputs.token }} - branch: "create-pull-request/update-cargo-lock" - title: "Cargo.lock update" - body: | - This PR has been automatically created by the [update-cargo-lock.yml](https://github.com/tracel-ai/burn/blob/main/.github/workflows/update-cargo-lock.yml) workflow. - commit-message: | - Update Cargo.lock - - This commit has been automatically generated by - update-cargo-lock.yml workflow. - labels: dependencies,automated - delete-branch: true diff --git a/.github/workflows/valgrind.yml b/.github/workflows/valgrind.yml deleted file mode 100644 index 8dcd56be6a..0000000000 --- a/.github/workflows/valgrind.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: valgrind - -on: - schedule: - - cron: '0 23 * * WED' # Run every Wednesday at 23:00 (UTC) - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - valgrind: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4.1.5 - - - name: Install llvmpipe and lavapipe - uses: ./.github/actions/setup-llvmpipe-lavapipe - - - name: Install valgrind - run: | - sudo apt-get install valgrind - - - name: Run cargo-valgrind - env: - CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER: "valgrind -s --leak-check=full --show-leak-kinds=all --error-exitcode=1" - # Looking for vulnerabilities - run: | - cargo test diff --git a/.github/workflows/vulnerabilities.yml b/.github/workflows/vulnerabilities.yml deleted file mode 100644 index d41f75c4a7..0000000000 --- a/.github/workflows/vulnerabilities.yml +++ /dev/null @@ -1,141 +0,0 @@ -name: vulnerabilities - -on: - schedule: - - cron: '0 21 * * WED' # Run every Wednesday at 21:00 (UTC) - push: - tags: - - 'v*.*.*' # Run when a new version is being published - -env: - # - # Dependency versioning - # - - # careful version - CAREFUL_VERSION: "0.4.0" - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - cargo-careful: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4.1.5 - - - name: Install Rust nightly - uses: dtolnay/rust-toolchain@nightly - with: - toolchain: nightly - components: rustfmt, rust-src - - - name: Install llvmpipe and lavapipe - uses: ./.github/actions/setup-llvmpipe-lavapipe - - - name: Install cargo-careful - env: - CAREFUL_LINK: https://github.com/RalfJung/cargo-careful/releases/download - run: | - curl -L "$CAREFUL_LINK/v$CAREFUL_VERSION/cargo-careful.x86_64-unknown-linux-musl" \ - --output $HOME/.cargo/bin/cargo-careful - chmod +x $HOME/.cargo/bin/cargo-careful - - - name: Run cargo-careful - # Looking for undefined behaviours - run: cargo +nightly careful test - - address-sanitizer: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4.1.5 - - - name: Install Rust nightly - uses: dtolnay/rust-toolchain@nightly - with: - toolchain: nightly - components: rustfmt, rust-src - - - name: Install llvmpipe and lavapipe - uses: ./.github/actions/setup-llvmpipe-lavapipe - - - name: Run AddressSanitizer - env: - RUSTFLAGS: -Zsanitizer=address -Copt-level=3 - RUSTDOCFLAGS: -Zsanitizer=address - # Looking for memory vulnerabilities - run: cargo test -Zbuild-std --target x86_64-unknown-linux-gnu -- --nocapture - - thread-sanitizer: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Install Rust nightly - uses: dtolnay/rust-toolchain@nightly - with: - toolchain: nightly - components: rustfmt, rust-src - - - name: Install llvmpipe and lavapipe - uses: ./.github/actions/setup-llvmpipe-lavapipe - - - name: Run ThreadSanitizer - env: - RUSTFLAGS: -Zsanitizer=thread -Copt-level=3 - RUSTDOCFLAGS: -Zsanitizer=thread - # Looking for data race among threads - run: cargo test -Zbuild-std --target x86_64-unknown-linux-gnu -- --nocapture - - memory-sanitizer: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4.1.5 - - - name: Install Rust nightly - uses: dtolnay/rust-toolchain@nightly - with: - toolchain: nightly - components: rustfmt, rust-src - - - name: Install llvmpipe and lavapipe - uses: ./.github/actions/setup-llvmpipe-lavapipe - - - name: Run MemorySanitizer - env: - RUSTFLAGS: -Zsanitizer=memory -Zsanitizer-memory-track-origins -Copt-level=3 - RUSTDOCFLAGS: -Zsanitizer=memory -Zsanitizer-memory-track-origins - # Looking for unitialized memory. - run: cargo test -Zbuild-std --target x86_64-unknown-linux-gnu -- --nocapture - - safe-stack: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4.1.5 - - - name: Install Rust nightly - uses: dtolnay/rust-toolchain@nightly - with: - toolchain: nightly - components: rustfmt, rust-src - - - name: Install llvmpipe and lavapipe - uses: ./.github/actions/setup-llvmpipe-lavapipe - - - name: Run SafeStack - env: - RUSTFLAGS: -Zsanitizer=safestack -Copt-level=3 - RUSTDOCFLAGS: -Zsanitizer=safestack - # Provides backward edge control flow protection - run: cargo test -Zbuild-std --target x86_64-unknown-linux-gnu -- --nocapture diff --git a/crates/burn-core/src/nn/attention/mask.rs b/crates/burn-core/src/nn/attention/mask.rs index a9ef538295..df9a301c1c 100644 --- a/crates/burn-core/src/nn/attention/mask.rs +++ b/crates/burn-core/src/nn/attention/mask.rs @@ -116,26 +116,26 @@ mod tests { ); } - #[test] - fn test_generate_padding_mask() { - let device = ::Device::default(); - let tokens = vec![ - vec![3, 3, 3], - vec![3, 3, 3], - vec![3, 3, 3, 4], - vec![3, 3, 3, 4, 10, 15], - ]; - - let mask = generate_padding_mask::(0, tokens, None, &device); - - assert_eq!( - mask.mask.into_data(), - Data::from([ - [false, false, false, true, true, true], - [false, false, false, true, true, true], - [false, false, false, false, true, true], - [false, false, false, false, false, false], - ]) - ); - } + // #[test] + // fn test_generate_padding_mask() { + // let device = ::Device::default(); + // let tokens = vec![ + // vec![3, 3, 3], + // vec![3, 3, 3], + // vec![3, 3, 3, 4], + // vec![3, 3, 3, 4, 10, 15], + // ]; + // + // let mask = generate_padding_mask::(0, tokens, None, &device); + // + // assert_eq!( + // mask.mask.into_data(), + // Data::from([ + // [false, false, false, true, true, true], + // [false, false, false, true, true, true], + // [false, false, false, false, true, true], + // [false, false, false, false, false, false], + // ]) + // ); + // } }