From a6bd0b47a5955008ef76eecdc0b2ec9acc7dd40c Mon Sep 17 00:00:00 2001 From: Nicolas Patry Date: Fri, 29 Dec 2023 10:17:52 +0100 Subject: [PATCH 1/5] Fix the CI. --- .github/workflows/ci_cuda.yaml | 2 ++ .github/workflows/rust-ci.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/ci_cuda.yaml b/.github/workflows/ci_cuda.yaml index ec792a25..0767e839 100644 --- a/.github/workflows/ci_cuda.yaml +++ b/.github/workflows/ci_cuda.yaml @@ -8,6 +8,8 @@ jobs: start-runner: name: Start self-hosted EC2 runner runs-on: ubuntu-latest + # Don't run on forks, they won't have access to secrets anyway. + if: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }} env: AWS_REGION: us-east-1 EC2_AMI_ID: ami-03cfed9ea28f4b002 diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml index 2ca53b23..2809aa58 100644 --- a/.github/workflows/rust-ci.yml +++ b/.github/workflows/rust-ci.yml @@ -40,6 +40,8 @@ jobs: profile: minimal toolchain: ${{ matrix.rust }} override: true + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 - uses: actions-rs/cargo@v1 with: command: test From 5b12fbb1433f09a3aeee530420dae284719d96e9 Mon Sep 17 00:00:00 2001 From: Nicolas Patry Date: Fri, 29 Dec 2023 11:13:33 +0100 Subject: [PATCH 2/5] Trying to fix flakyness by making hub_2 and hub_3 serial tests (potential issue on mingw with mmap). --- .github/workflows/rust-ci.yml | 2 -- candle-book/src/lib.rs | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml index 2809aa58..2ca53b23 100644 --- a/.github/workflows/rust-ci.yml +++ b/.github/workflows/rust-ci.yml @@ -40,8 +40,6 @@ jobs: profile: minimal toolchain: ${{ matrix.rust }} override: true - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - uses: actions-rs/cargo@v1 with: command: test diff --git a/candle-book/src/lib.rs b/candle-book/src/lib.rs index a1ec1e94..576ea7f2 100644 --- a/candle-book/src/lib.rs +++ b/candle-book/src/lib.rs @@ -43,11 +43,11 @@ let mmap = unsafe { Mmap::map(&file).unwrap() }; let weights = candle::safetensors::load_buffer(&mmap[..], &Device::Cpu).unwrap(); // ANCHOR_END: book_hub_2 assert_eq!(weights.len(), 206); - } + // } - #[rustfmt::skip] - #[test] - fn book_hub_3() { + // #[rustfmt::skip] + // #[test] + // fn book_hub_3() { // ANCHOR: book_hub_3 use candle::{DType, Device, Tensor}; use hf_hub::api::sync::Api; From d76ac20e0e84a2ed098f50d8aed3def686ec9311 Mon Sep 17 00:00:00 2001 From: Nicolas Patry Date: Fri, 29 Dec 2023 12:06:38 +0100 Subject: [PATCH 3/5] Fix. --- candle-book/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/candle-book/src/lib.rs b/candle-book/src/lib.rs index 576ea7f2..f8ca510d 100644 --- a/candle-book/src/lib.rs +++ b/candle-book/src/lib.rs @@ -28,6 +28,7 @@ let weights = candle::safetensors::load(weights_filename, &Device::Cpu).unwrap() #[rustfmt::skip] #[test] fn book_hub_2() { + { // ANCHOR: book_hub_2 use candle::Device; use hf_hub::api::sync::Api; @@ -43,11 +44,12 @@ let mmap = unsafe { Mmap::map(&file).unwrap() }; let weights = candle::safetensors::load_buffer(&mmap[..], &Device::Cpu).unwrap(); // ANCHOR_END: book_hub_2 assert_eq!(weights.len(), 206); - // } + } // #[rustfmt::skip] // #[test] // fn book_hub_3() { + { // ANCHOR: book_hub_3 use candle::{DType, Device, Tensor}; use hf_hub::api::sync::Api; @@ -102,6 +104,7 @@ let tp_tensor = Tensor::from_raw_buffer(&raw, dtype, &tp_shape, &Device::Cpu).un assert_eq!(view.shape(), &[768, 768]); assert_eq!(tp_tensor.dims(), &[192, 768]); } +} #[rustfmt::skip] #[test] From 4907c63ea1deb4ee4a5eb78b2b3f33ebc36a598e Mon Sep 17 00:00:00 2001 From: Nicolas Patry Date: Fri, 29 Dec 2023 12:12:10 +0100 Subject: [PATCH 4/5] Ignore stop on remote forks. --- .github/workflows/ci_cuda.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cuda.yaml b/.github/workflows/ci_cuda.yaml index 0767e839..c67475f2 100644 --- a/.github/workflows/ci_cuda.yaml +++ b/.github/workflows/ci_cuda.yaml @@ -72,7 +72,7 @@ jobs: runs-on: ubuntu-latest env: AWS_REGION: us-east-1 - if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs + if: ${{ always() && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }} # required to stop the runner even if the error happened in the previous jobs steps: - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 From adc95ca2bf6f165b4d5045a791e56de83d71d7b4 Mon Sep 17 00:00:00 2001 From: Nicolas Patry Date: Fri, 29 Dec 2023 12:15:57 +0100 Subject: [PATCH 5/5] Ignore skipped. --- .github/workflows/ci_cuda.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cuda.yaml b/.github/workflows/ci_cuda.yaml index c67475f2..02814ed7 100644 --- a/.github/workflows/ci_cuda.yaml +++ b/.github/workflows/ci_cuda.yaml @@ -72,7 +72,7 @@ jobs: runs-on: ubuntu-latest env: AWS_REGION: us-east-1 - if: ${{ always() && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }} # required to stop the runner even if the error happened in the previous jobs + if: ${{ (success() || failure()) && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }} # required to stop the runner even if the error happened in the previous jobs steps: - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1