From 4855e479820c27c4ca6b08d52e00c6e7c233abb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mochol=C3=AD?= Date: Sun, 25 Feb 2024 01:31:56 +0100 Subject: [PATCH 01/16] Try Astral uv for CI --- .github/workflows/cpu-tests.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cpu-tests.yml b/.github/workflows/cpu-tests.yml index 9c1522ce47..86ffd0a87c 100644 --- a/.github/workflows/cpu-tests.yml +++ b/.github/workflows/cpu-tests.yml @@ -45,10 +45,17 @@ jobs: requirements-all.txt setup.py + - name: Install uv + run: | + # Set the VIRTUAL_ENV variable for uv to work + # https://github.com/astral-sh/uv/issues/1526 + echo "VIRTUAL_ENV=${Python_ROOT_DIR}" >> $GITHUB_ENV + curl -LsSf https://astral.sh/uv/install.sh | sh + - name: Install minimal dependencies run: | - pip install -r requirements.txt - pip list + uv pip install -r requirements.txt + uv pip list # make sure all modules are importable modules=$( find * -type f -name "*.py" | \ @@ -61,8 +68,8 @@ jobs: - name: Install all dependencies run: | - pip install -r requirements-all.txt pytest pytest-rerunfailures pytest-timeout transformers>=4.36.0 einops protobuf - pip list + uv pip install -r requirements-all.txt pytest pytest-rerunfailures pytest-timeout transformers>=4.36.0 einops protobuf + uv pip list - name: Run tests without the package installed run: | @@ -70,6 +77,6 @@ jobs: - name: Run tests run: | - pip install . --no-deps + uv pip install . --no-deps pytest -v --disable-pytest-warnings --strict-markers --color=yes --timeout 120 From 9d95a583a338857ba7eefa919d2df3dcde8a2e43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mochol=C3=AD?= Date: Sun, 25 Feb 2024 01:42:03 +0100 Subject: [PATCH 02/16] Try pip install --- .github/workflows/cpu-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cpu-tests.yml b/.github/workflows/cpu-tests.yml index 43b95bb498..79a1b7e895 100644 --- a/.github/workflows/cpu-tests.yml +++ b/.github/workflows/cpu-tests.yml @@ -47,10 +47,10 @@ jobs: - name: Install uv run: | + pip install uv # Set the VIRTUAL_ENV variable for uv to work # https://github.com/astral-sh/uv/issues/1526 echo "VIRTUAL_ENV=${Python_ROOT_DIR}" >> $GITHUB_ENV - curl -LsSf https://astral.sh/uv/install.sh | sh - name: Install minimal dependencies run: | From 31301711c6c9cb07314fca47dd857110f15d2ee6 Mon Sep 17 00:00:00 2001 From: Andrei-Aksionov Date: Tue, 5 Mar 2024 11:52:08 +0300 Subject: [PATCH 03/16] Sync with the latest changes in UV --- .github/workflows/cpu-tests.yml | 9 +++------ requirements-all.txt | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cpu-tests.yml b/.github/workflows/cpu-tests.yml index 79a1b7e895..6d62c01f08 100644 --- a/.github/workflows/cpu-tests.yml +++ b/.github/workflows/cpu-tests.yml @@ -48,13 +48,10 @@ jobs: - name: Install uv run: | pip install uv - # Set the VIRTUAL_ENV variable for uv to work - # https://github.com/astral-sh/uv/issues/1526 - echo "VIRTUAL_ENV=${Python_ROOT_DIR}" >> $GITHUB_ENV - name: Install minimal dependencies run: | - uv pip install -r requirements.txt + uv pip install --system -r requirements.txt uv pip list # make sure all modules are importable modules=$( @@ -68,7 +65,7 @@ jobs: - name: Install all dependencies run: | - uv pip install -r requirements-all.txt pytest pytest-rerunfailures pytest-timeout transformers>=4.38.0 einops protobuf + uv pip install --system -r requirements-all.txt pytest pytest-rerunfailures pytest-timeout transformers>=4.38.0 einops protobuf uv pip list - name: Run tests without the package installed @@ -77,6 +74,6 @@ jobs: - name: Run tests run: | - uv pip install . --no-deps + uv pip install --system . --no-deps pytest -v --disable-pytest-warnings --strict-markers --color=yes --timeout 120 diff --git a/requirements-all.txt b/requirements-all.txt index a6cdf33fad..35ee5b9be5 100644 --- a/requirements-all.txt +++ b/requirements-all.txt @@ -12,6 +12,6 @@ pyarrow # scripts/prepare_starcoder.py tensorboard # pretrain/tinyllama.py torchmetrics # pretrain/tinyllama.py # eval -git+https://github.com/EleutherAI/lm-evaluation-harness.git@115206dc89dad67b8beaa90051fb52db77f0a529 +lm_eval @ git+https://github.com/EleutherAI/lm-evaluation-harness.git@115206dc89dad67b8beaa90051fb52db77f0a529 # scripts/prepare_slimpajama.py, scripts/prepare_starcoder.py, pretrain/tinyllama.py lightning[data] @ git+https://github.com/Lightning-AI/lightning@ed367ca675861cdf40dbad2e4d66f7eee2ec50af From a0314ecc55db49d3089986eee672eca211c1da23 Mon Sep 17 00:00:00 2001 From: Andrei-Aksionov Date: Tue, 5 Mar 2024 12:03:44 +0300 Subject: [PATCH 04/16] Comment of why to use --system flag --- .github/workflows/cpu-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/cpu-tests.yml b/.github/workflows/cpu-tests.yml index 6d62c01f08..0682a8bb1a 100644 --- a/.github/workflows/cpu-tests.yml +++ b/.github/workflows/cpu-tests.yml @@ -51,6 +51,8 @@ jobs: - name: Install minimal dependencies run: | + # Use `--system` flag to allow global installs in CI + # https://github.com/astral-sh/uv/issues/1526 uv pip install --system -r requirements.txt uv pip list # make sure all modules are importable From 2344b72a388ce67e2e634ef82cbd3452eeaade10 Mon Sep 17 00:00:00 2001 From: Andrei-Aksionov Date: Tue, 5 Mar 2024 12:33:56 +0300 Subject: [PATCH 05/16] Try cache for uv --- .github/workflows/cpu-tests.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cpu-tests.yml b/.github/workflows/cpu-tests.yml index 0682a8bb1a..27d623292b 100644 --- a/.github/workflows/cpu-tests.yml +++ b/.github/workflows/cpu-tests.yml @@ -39,16 +39,22 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - cache: 'pip' - cache-dependency-path: | - requirements.txt - requirements-all.txt - setup.py + # cache: 'pip' + # cache-dependency-path: | + # requirements.txt + # requirements-all.txt + # setup.py - name: Install uv run: | pip install uv + - uses: actions/cache@v4 + id: cache-uv + with: + path: ~/.cache/uv + key: ${{ runner.os }}-python-${{ matrix.python-version }}-uv + - name: Install minimal dependencies run: | # Use `--system` flag to allow global installs in CI From 24bfca987d0c9a5db8acb42844b704265fa83b92 Mon Sep 17 00:00:00 2001 From: Andrei-Aksionov Date: Tue, 5 Mar 2024 12:37:10 +0300 Subject: [PATCH 06/16] UV cache updates --- .github/workflows/cpu-tests.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cpu-tests.yml b/.github/workflows/cpu-tests.yml index 27d623292b..adfd253778 100644 --- a/.github/workflows/cpu-tests.yml +++ b/.github/workflows/cpu-tests.yml @@ -49,11 +49,11 @@ jobs: run: | pip install uv - - uses: actions/cache@v4 - id: cache-uv - with: - path: ~/.cache/uv - key: ${{ runner.os }}-python-${{ matrix.python-version }}-uv + - name: UV cache + uses: actions/cache@v4 + with: + path: ~/.cache/uv + key: ${{ runner.os }}-python-${{ matrix.python-version }}-uv - name: Install minimal dependencies run: | From 19a456a2e3e7e267ba66bff35c99b30a15ad1726 Mon Sep 17 00:00:00 2001 From: Andrei-Aksionov Date: Tue, 5 Mar 2024 12:46:01 +0300 Subject: [PATCH 07/16] Update to force UV to use cache --- .github/workflows/cpu-tests.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/cpu-tests.yml b/.github/workflows/cpu-tests.yml index adfd253778..07958ec62e 100644 --- a/.github/workflows/cpu-tests.yml +++ b/.github/workflows/cpu-tests.yml @@ -39,11 +39,6 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - # cache: 'pip' - # cache-dependency-path: | - # requirements.txt - # requirements-all.txt - # setup.py - name: Install uv run: | From 717572a418591f973b7197dcc415f6654bcf94eb Mon Sep 17 00:00:00 2001 From: Andrei-Aksionov Date: Fri, 15 Mar 2024 15:55:35 +0300 Subject: [PATCH 08/16] Integrate the newest changes --- .github/workflows/cpu-tests.yml | 14 +++++++------- requirements-all.txt | 17 ----------------- 2 files changed, 7 insertions(+), 24 deletions(-) delete mode 100644 requirements-all.txt diff --git a/.github/workflows/cpu-tests.yml b/.github/workflows/cpu-tests.yml index 1d896e2617..b292614659 100644 --- a/.github/workflows/cpu-tests.yml +++ b/.github/workflows/cpu-tests.yml @@ -39,14 +39,14 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - cache: 'pip' - cache-dependency-path: | - pyproject.toml + + - name: Install uv + run: pip install uv - name: Install minimal dependencies run: | - pip install . - pip list + uv pip install --system . + uv pip list # make sure all modules are still importable with only the minimal dependencies available modules=$( find litgpt -type f -name "*.py" | \ @@ -58,8 +58,8 @@ jobs: - name: Install all dependencies run: | - pip install '.[all,test]' - pip list + uv pip install --system '.[all,test]' + uv pip list - name: Run tests run: | diff --git a/requirements-all.txt b/requirements-all.txt deleted file mode 100644 index 35ee5b9be5..0000000000 --- a/requirements-all.txt +++ /dev/null @@ -1,17 +0,0 @@ --r requirements.txt -jsonargparse[signatures] # CLI -bitsandbytes==0.41.0 # quantization -scipy # required by bitsandbytes -sentencepiece # llama-based models -tokenizers # pythia, falcon, redpajama -datasets # eval -requests # scripts/prepare_* -zstandard # scripts/prepare_redpajama.py, scripts/prepare_starcoder.py -pandas # scripts/prepare_csv.py, scripts/prepare_starcoder.py -pyarrow # scripts/prepare_starcoder.py -tensorboard # pretrain/tinyllama.py -torchmetrics # pretrain/tinyllama.py -# eval -lm_eval @ git+https://github.com/EleutherAI/lm-evaluation-harness.git@115206dc89dad67b8beaa90051fb52db77f0a529 -# scripts/prepare_slimpajama.py, scripts/prepare_starcoder.py, pretrain/tinyllama.py -lightning[data] @ git+https://github.com/Lightning-AI/lightning@ed367ca675861cdf40dbad2e4d66f7eee2ec50af From 074140218f9dbf66e08e1e0b47ad134393f80b9d Mon Sep 17 00:00:00 2001 From: Andrei-Aksionov Date: Fri, 15 Mar 2024 16:01:13 +0300 Subject: [PATCH 09/16] Workaround for `install .` --- .github/workflows/cpu-tests.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cpu-tests.yml b/.github/workflows/cpu-tests.yml index b292614659..0045afa924 100644 --- a/.github/workflows/cpu-tests.yml +++ b/.github/workflows/cpu-tests.yml @@ -45,7 +45,9 @@ jobs: - name: Install minimal dependencies run: | - uv pip install --system . + # uv pip install . is not yet supported, only `-e .` + # https://github.com/astral-sh/uv/issues/1896 + uv pip install --system -e . uv pip list # make sure all modules are still importable with only the minimal dependencies available modules=$( @@ -58,7 +60,7 @@ jobs: - name: Install all dependencies run: | - uv pip install --system '.[all,test]' + uv pip install --system -e '.[all,test]' uv pip list - name: Run tests From e600c0269c3672a3cd15c1833546879b9670508c Mon Sep 17 00:00:00 2001 From: Andrei-Aksionov Date: Fri, 15 Mar 2024 16:18:42 +0300 Subject: [PATCH 10/16] checkout@v3 is deprecated --- .github/workflows/cpu-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cpu-tests.yml b/.github/workflows/cpu-tests.yml index 0045afa924..69ad269499 100644 --- a/.github/workflows/cpu-tests.yml +++ b/.github/workflows/cpu-tests.yml @@ -33,7 +33,7 @@ jobs: timeout-minutes: 25 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 From 8622d32aaa719b98811f75ef30ef8b4cf0eeff1c Mon Sep 17 00:00:00 2001 From: Andrei-Aksionov Date: Fri, 15 Mar 2024 16:27:35 +0300 Subject: [PATCH 11/16] Cache --- .github/workflows/cpu-tests.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/cpu-tests.yml b/.github/workflows/cpu-tests.yml index 69ad269499..f188af720a 100644 --- a/.github/workflows/cpu-tests.yml +++ b/.github/workflows/cpu-tests.yml @@ -43,6 +43,12 @@ jobs: - name: Install uv run: pip install uv + - name: Cache for uv + uses: actions/cache@v4 + with: + path: ~/.cache/uv + key: ${{ runner.os }}-python-${{ matrix.python-version }}-uv + - name: Install minimal dependencies run: | # uv pip install . is not yet supported, only `-e .` From c1e5cd1ae8b195c006a89be1e739b5876b73f08e Mon Sep 17 00:00:00 2001 From: Andrei-Aksionov Date: Fri, 15 Mar 2024 16:58:35 +0300 Subject: [PATCH 12/16] Support of cache_dir per OS --- .github/workflows/cpu-tests.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cpu-tests.yml b/.github/workflows/cpu-tests.yml index f188af720a..e18d0890fd 100644 --- a/.github/workflows/cpu-tests.yml +++ b/.github/workflows/cpu-tests.yml @@ -43,10 +43,18 @@ jobs: - name: Install uv run: pip install uv + - name: Define cache folder location per OS + if: startsWith(runner.os, 'Linux') + run: echo "cache_dir=~/.cache/uv" >> "$GITHUB_ENV" + if: startsWith(runner.os, 'MacOS') + run: echo "cache_dir=~/Library/Caches/uv" >> "$GITHUB_ENV" + if: startsWith(runner.os, 'Windows') + run: echo "cache_dir=~\AppData\Local\cache\Cache" >> "$GITHUB_ENV" + - name: Cache for uv uses: actions/cache@v4 with: - path: ~/.cache/uv + path: env.cache_dir key: ${{ runner.os }}-python-${{ matrix.python-version }}-uv - name: Install minimal dependencies From 3952f0de0cd98aa0060f84d4aee0d573085fea70 Mon Sep 17 00:00:00 2001 From: Andrei-Aksionov Date: Fri, 15 Mar 2024 17:01:51 +0300 Subject: [PATCH 13/16] Try another variant of if statement --- .github/workflows/cpu-tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cpu-tests.yml b/.github/workflows/cpu-tests.yml index e18d0890fd..d2b60cdc92 100644 --- a/.github/workflows/cpu-tests.yml +++ b/.github/workflows/cpu-tests.yml @@ -45,11 +45,11 @@ jobs: - name: Define cache folder location per OS if: startsWith(runner.os, 'Linux') - run: echo "cache_dir=~/.cache/uv" >> "$GITHUB_ENV" + run: echo "cache_dir=~/.cache/uv" >> "$GITHUB_ENV" if: startsWith(runner.os, 'MacOS') - run: echo "cache_dir=~/Library/Caches/uv" >> "$GITHUB_ENV" + run: echo "cache_dir=~/Library/Caches/uv" >> "$GITHUB_ENV" if: startsWith(runner.os, 'Windows') - run: echo "cache_dir=~\AppData\Local\cache\Cache" >> "$GITHUB_ENV" + run: echo "cache_dir=~\AppData\Local\cache\Cache" >> "$GITHUB_ENV" - name: Cache for uv uses: actions/cache@v4 From 5f5eb516d13cb60055e1f17ce7c33ab39dd60fe5 Mon Sep 17 00:00:00 2001 From: Andrei-Aksionov Date: Fri, 15 Mar 2024 17:04:44 +0300 Subject: [PATCH 14/16] Another variant of defining cache folder --- .github/workflows/cpu-tests.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cpu-tests.yml b/.github/workflows/cpu-tests.yml index d2b60cdc92..559376630d 100644 --- a/.github/workflows/cpu-tests.yml +++ b/.github/workflows/cpu-tests.yml @@ -43,11 +43,13 @@ jobs: - name: Install uv run: pip install uv - - name: Define cache folder location per OS + - name: Define cache folder for Linux if: startsWith(runner.os, 'Linux') run: echo "cache_dir=~/.cache/uv" >> "$GITHUB_ENV" + - name: Define cache folder for MacOs if: startsWith(runner.os, 'MacOS') run: echo "cache_dir=~/Library/Caches/uv" >> "$GITHUB_ENV" + - name: Define cache folder for Windows if: startsWith(runner.os, 'Windows') run: echo "cache_dir=~\AppData\Local\cache\Cache" >> "$GITHUB_ENV" From 596d7c0e61e30a700630b4fb4bb63ae068118a08 Mon Sep 17 00:00:00 2001 From: Andrei-Aksionov Date: Fri, 15 Mar 2024 17:15:30 +0300 Subject: [PATCH 15/16] Get rid of caching --- .github/workflows/cpu-tests.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.github/workflows/cpu-tests.yml b/.github/workflows/cpu-tests.yml index 559376630d..69ad269499 100644 --- a/.github/workflows/cpu-tests.yml +++ b/.github/workflows/cpu-tests.yml @@ -43,22 +43,6 @@ jobs: - name: Install uv run: pip install uv - - name: Define cache folder for Linux - if: startsWith(runner.os, 'Linux') - run: echo "cache_dir=~/.cache/uv" >> "$GITHUB_ENV" - - name: Define cache folder for MacOs - if: startsWith(runner.os, 'MacOS') - run: echo "cache_dir=~/Library/Caches/uv" >> "$GITHUB_ENV" - - name: Define cache folder for Windows - if: startsWith(runner.os, 'Windows') - run: echo "cache_dir=~\AppData\Local\cache\Cache" >> "$GITHUB_ENV" - - - name: Cache for uv - uses: actions/cache@v4 - with: - path: env.cache_dir - key: ${{ runner.os }}-python-${{ matrix.python-version }}-uv - - name: Install minimal dependencies run: | # uv pip install . is not yet supported, only `-e .` From cb989cb51758950d078358907a441d9be7be4901 Mon Sep 17 00:00:00 2001 From: Andrei-Aksionov Date: Fri, 15 Mar 2024 17:26:08 +0300 Subject: [PATCH 16/16] Increase UV_HTTP_TIMEOUT to 500s --- .github/workflows/cpu-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cpu-tests.yml b/.github/workflows/cpu-tests.yml index 69ad269499..1b4e7687c6 100644 --- a/.github/workflows/cpu-tests.yml +++ b/.github/workflows/cpu-tests.yml @@ -16,6 +16,7 @@ defaults: env: HF_TOKEN: ${{ secrets.HF_TOKEN }} + UV_HTTP_TIMEOUT: 500 jobs: cpu-tests: