Skip to content

Commit 24f0bfd

Browse files
committed
build: fix torch build to work with the installation of vision models
1 parent 4f18e5b commit 24f0bfd

2 files changed

Lines changed: 17 additions & 15 deletions

File tree

.gitlab-ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ ruff-lint:
4747
before_script:
4848
- *default-before-script
4949
- uv pip install -U pip wheel setuptools
50-
- uv sync --group=dev
50+
- uv sync --group=dev --extra=cpu
5151
script:
5252
- uv run --no-sync make check-ruff-lint
5353
tags:
@@ -64,7 +64,7 @@ pytest-py38:
6464
- *default-before-script
6565
- uv pip install -U pip wheel setuptools
6666
- bash scripts/install_uv.sh --no-weights --cpu -m "detectron2,yolox,segment_anything,jde"
67-
- uv sync --inexact --extra=dev
67+
- uv sync --inexact --extra=dev --extra=cpu
6868
script:
6969
- uv run --no-sync pytest
7070
tags:
@@ -81,7 +81,7 @@ pytest-py310:
8181
- *default-before-script
8282
- uv pip install -U pip wheel setuptools
8383
- bash scripts/install_uv.sh --no-weights --cpu -m "detectron2,yolox,segment_anything,jde"
84-
- uv sync --inexact --extra=dev
84+
- uv sync --inexact --extra=dev --extra=cpu
8585
script:
8686
- uv run --no-sync pytest
8787
tags:
@@ -96,7 +96,7 @@ pytest-pip-py38:
9696
- python3 -m venv venv
9797
- source venv/bin/activate
9898
- pip install -U pip wheel setuptools
99-
- pip install torch==2.0.0 torchvision==0.15.1 --index-url https://download.pytorch.org/whl/cpu
99+
- pip install torch==2.0.0 torchvision==0.15.1 --index-url https://download.pytorch.org/whl/cpu --extra-index-url https://pypi.org/simple
100100
- bash scripts/install.sh --no-weights --cpu -m "detectron2,yolox,segment_anything,jde"
101101
- pip install -e .[dev,cpu]
102102
script:
@@ -126,7 +126,7 @@ ruff-format:
126126
before_script:
127127
- *default-before-script
128128
- uv pip install -U pip wheel setuptools
129-
- uv sync --group=dev
129+
- uv sync --group=dev --extra=cpu
130130
script:
131131
- uv run --no-sync make check-ruff-format
132132
tags:
@@ -138,7 +138,7 @@ ruff-organize-imports:
138138
before_script:
139139
- *default-before-script
140140
- uv pip install -U pip wheel setuptools
141-
- uv sync --group=dev
141+
- uv sync --group=dev --extra=cpu
142142
script:
143143
- uv run --no-sync make check-ruff-organize-imports
144144
tags:
@@ -150,7 +150,7 @@ doc:
150150
before_script:
151151
- *default-before-script
152152
- uv pip install -U pip wheel setuptools
153-
- uv sync --group=doc
153+
- uv sync --group=doc --extra=cpu
154154
- cd docs
155155
script:
156156
- uv run --no-sync make html

scripts/install.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,9 @@ detect_cuda_version () {
258258
}
259259

260260
install_torch () {
261-
"${PIP[@]}" install "torch==${TORCH_VERSION}" "torchvision==${TORCHVISION_VERSION}" --index-url "https://download.pytorch.org/whl/${BUILD_SUFFIX}"
261+
"${PIP[@]}" install "torch==${TORCH_VERSION}" "torchvision==${TORCHVISION_VERSION}" \
262+
--index-url "https://download.pytorch.org/whl/${BUILD_SUFFIX}" \
263+
--extra-index-url "https://pypi.org/simple"
262264

263265
}
264266

@@ -294,7 +296,7 @@ install_detectron2 () {
294296
"${PIP[@]}" install --no-build-isolation -e .
295297
elif [[ "${PACKAGE_MANAGER}" == "uv" ]]; then
296298
cd "${COMPRESSAI_VISION_ROOT_DIR}"
297-
uv sync --inexact --group=models-detectron2
299+
uv sync --inexact --group=models-detectron2 --extra="${BUILD_SUFFIX}"
298300
fi
299301

300302
cd "${COMPRESSAI_VISION_ROOT_DIR}"
@@ -367,7 +369,7 @@ install_jde () {
367369
"${PIP[@]}" install --no-build-isolation -e .
368370
elif [[ "${PACKAGE_MANAGER}" == "uv" ]]; then
369371
cd "${COMPRESSAI_VISION_ROOT_DIR}"
370-
uv sync --inexact --group=models-jde
372+
uv sync --inexact --group=models-jde --extra="${BUILD_SUFFIX}"
371373
fi
372374

373375
cd "${COMPRESSAI_VISION_ROOT_DIR}"
@@ -403,7 +405,7 @@ install_yolox () {
403405
"${PIP[@]}" install --no-build-isolation -e .
404406
elif [[ "${PACKAGE_MANAGER}" == "uv" ]]; then
405407
cd "${COMPRESSAI_VISION_ROOT_DIR}"
406-
uv sync --inexact --group=models-yolox
408+
uv sync --inexact --group=models-yolox --extra="${BUILD_SUFFIX}"
407409
fi
408410

409411
cd "${COMPRESSAI_VISION_ROOT_DIR}"
@@ -442,7 +444,7 @@ install_mmpose () {
442444
"${PIP[@]}" install isort==5.13.2
443445
elif [[ "${PACKAGE_MANAGER}" == "uv" ]]; then
444446
cd "${COMPRESSAI_VISION_ROOT_DIR}"
445-
uv sync --inexact --group=models-mmpose
447+
uv sync --inexact --group=models-mmpose --extra="${BUILD_SUFFIX}"
446448
fi
447449

448450
"${MIM[@]}" install "mmcv==2.0.1"
@@ -478,7 +480,7 @@ install_segment_anything () {
478480
"${PIP[@]}" install -e .
479481
elif [[ "${PACKAGE_MANAGER}" == "uv" ]]; then
480482
cd "${COMPRESSAI_VISION_ROOT_DIR}"
481-
uv sync --inexact --group=models-segment-anything
483+
uv sync --inexact --group=models-segment-anything --extra="${BUILD_SUFFIX}"
482484
fi
483485

484486
cd "${COMPRESSAI_VISION_ROOT_DIR}"
@@ -513,7 +515,7 @@ install_sam2 () {
513515
"${PIP[@]}" install -e .
514516
elif [[ "${PACKAGE_MANAGER}" == "uv" ]]; then
515517
cd "${COMPRESSAI_VISION_ROOT_DIR}"
516-
uv sync --inexact --group=models-sam2
518+
uv sync --inexact --group=models-sam2 --extra="${BUILD_SUFFIX}"
517519
fi
518520

519521
cd "${COMPRESSAI_VISION_ROOT_DIR}"
@@ -568,4 +570,4 @@ download_weights () {
568570

569571
if [[ "${__SOURCE_ONLY__:-0}" -eq 0 ]]; then
570572
main "$@"
571-
fi
573+
fi

0 commit comments

Comments
 (0)