Skip to content

Commit 4e83fe3

Browse files
ZherphyZherphy
authored andcommitted
feat: [CI] Introduce uv to accelerate pip install
- Add UV environment variables for PyPI mirror configuration - Replace pip install with uv pip install for faster package installation - Pass UV env vars to docker container for ms-swift CI Signed-off-by: Zherphy <1123678689@qq.com>
1 parent 6ea7b40 commit 4e83fe3

4 files changed

Lines changed: 32 additions & 11 deletions

File tree

.dev_scripts/ci_container_test.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
if [ "$MODELSCOPE_SDK_DEBUG" == "True" ]; then
2-
# pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
3-
pip install -r requirements/tests.txt -i https://mirrors.aliyun.com/pypi/simple/
2+
pip install uv
3+
uv pip install -r requirements/tests.txt
44
git config --global --add safe.directory /ms-swift
55
git config --global user.email tmp
66
git config --global user.name tmp.com
@@ -20,17 +20,17 @@ if [ "$MODELSCOPE_SDK_DEBUG" == "True" ]; then
2020
fi
2121
fi
2222

23-
pip install -r requirements/framework.txt -U -i https://mirrors.aliyun.com/pypi/simple/
24-
pip install decord einops -U -i https://mirrors.aliyun.com/pypi/simple/
23+
uv pip install -r requirements/framework.txt -U
24+
uv pip install decord einops -U
2525
pip uninstall autoawq -y
26-
pip install optimum
27-
pip install diffusers
28-
pip install "transformers<5.0"
26+
uv pip install optimum
27+
uv pip install diffusers
28+
uv pip install "transformers<5.0"
2929
# pip install autoawq -U --no-deps
3030

3131
# test with install
32-
pip install .
33-
pip install auto_gptq bitsandbytes deepspeed -U -i https://mirrors.aliyun.com/pypi/simple/
32+
uv pip install .
33+
uv pip install auto_gptq bitsandbytes deepspeed -U
3434
else
3535
echo "Running case in release image, run case directly!"
3636
fi

.dev_scripts/dockerci.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ do
4949
-e MODEL_TAG_URL=$MODEL_TAG_URL \
5050
-e MODELSCOPE_API_TOKEN=$MODELSCOPE_API_TOKEN \
5151
-e PR_CHANGED_FILES=$PR_CHANGED_FILES \
52+
-e UV_INDEX_URL=$UV_INDEX_URL \
53+
-e UV_EXTRA_INDEX_URL=$UV_EXTRA_INDEX_URL \
54+
-e UV_INDEX_STRATEGY=$UV_INDEX_STRATEGY \
55+
-e UV_NO_CACHE=$UV_NO_CACHE \
56+
-e UV_SYSTEM_PYTHON=$UV_SYSTEM_PYTHON \
5257
--workdir=$CODE_DIR_IN_CONTAINER \
5358
${IMAGE_NAME}:${IMAGE_VERSION} \
5459
$CI_COMMAND
@@ -73,6 +78,11 @@ do
7378
-e MODEL_TAG_URL=$MODEL_TAG_URL \
7479
-e MODELSCOPE_API_TOKEN=$MODELSCOPE_API_TOKEN \
7580
-e PR_CHANGED_FILES=$PR_CHANGED_FILES \
81+
-e UV_INDEX_URL=$UV_INDEX_URL \
82+
-e UV_EXTRA_INDEX_URL=$UV_EXTRA_INDEX_URL \
83+
-e UV_INDEX_STRATEGY=$UV_INDEX_STRATEGY \
84+
-e UV_NO_CACHE=$UV_NO_CACHE \
85+
-e UV_SYSTEM_PYTHON=$UV_SYSTEM_PYTHON \
7686
--workdir=$CODE_DIR_IN_CONTAINER \
7787
${IMAGE_NAME}:${IMAGE_VERSION} \
7888
$CI_COMMAND

.github/workflows/citest.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ jobs:
7171
run: git lfs checkout
7272
- name: Run unittest
7373
shell: bash
74+
env:
75+
UV_INDEX_URL: "http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple"
76+
UV_EXTRA_INDEX_URL: "https://mirrors.huaweicloud.com/ascend/repos/pypi"
77+
UV_INDEX_STRATEGY: "unsafe-best-match"
78+
UV_NO_CACHE: 1
79+
UV_SYSTEM_PYTHON: 1
7480
run: |
7581
set -e
7682
source /mnt/modelscope/ci_env.sh

.github/workflows/citest_npu.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,17 @@ jobs:
4343
timeout-minutes: 240
4444
container:
4545
image: 'ascendai/cann:8.3.rc2-910b-ubuntu22.04-py3.11'
46+
env:
47+
UV_INDEX_URL: "http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple"
48+
UV_EXTRA_INDEX_URL: "https://mirrors.huaweicloud.com/ascend/repos/pypi"
49+
UV_INDEX_STRATEGY: "unsafe-best-match"
50+
UV_NO_CACHE: 1
51+
UV_SYSTEM_PYTHON: 1
4652
steps:
4753
- name: Config mirrors
4854
run: |
4955
sed -Ei 's@(ports|archive).ubuntu.com@cache-service.nginx-pypi-cache.svc.cluster.local:8081@g' /etc/apt/sources.list
50-
pip config set global.index-url http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple
51-
pip config set global.trusted-host cache-service.nginx-pypi-cache.svc.cluster.local
56+
pip install uv
5257
5358
- name: Checkout
5459
uses: actions/checkout@v3

0 commit comments

Comments
 (0)