Skip to content

Commit b3a10d0

Browse files
Enable trainer tests (#495)
1 parent 311b3a6 commit b3a10d0

File tree

6 files changed

+36
-46
lines changed

6 files changed

+36
-46
lines changed

.github/components-path-filters.yml

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -281,31 +281,30 @@ interactive_ai/workflows/geti_domain/train:
281281
- Makefile.shared-python
282282
- Makefile.shared
283283
- .github/workflows/component.yml
284-
# TODO: Re-enable CVS-166868
285-
#interactive_ai/workflows/otx_domain/trainer/otx_v2/xpu:
286-
# - interactive_ai/workflows/otx_domain/trainer/otx_v2/xpu/**
287-
# - interactive_ai/workflows/otx_domain/trainer/otx_v2/scripts/**
288-
# - interactive_ai/workflows/otx_domain/trainer/otx_v2/tests/**
289-
# - interactive_ai/workflows/otx_domain/trainer/otx_v2/download_pretrained_weights.py
290-
# - interactive_ai/workflows/otx_domain/trainer/otx_v2/pyproject.toml
291-
# - interactive_ai/workflows/otx_domain/trainer/otx_v2/run
292-
# - libs/telemetry_tools/**
293-
# - libs/kafka_tools/**
294-
# - Makefile.shared-python
295-
# - Makefile.shared
296-
# - .github/workflows/component.yml
297-
# interactive_ai/workflows/otx_domain/trainer/otx_v2/gpu:
298-
# - interactive_ai/workflows/otx_domain/trainer/otx_v2/gpu/**
299-
# - interactive_ai/workflows/otx_domain/trainer/otx_v2/scripts/**
300-
# - interactive_ai/workflows/otx_domain/trainer/otx_v2/tests/**
301-
# - interactive_ai/workflows/otx_domain/trainer/otx_v2/download_pretrained_weights.py
302-
# - interactive_ai/workflows/otx_domain/trainer/otx_v2/pyproject.toml
303-
# - interactive_ai/workflows/otx_domain/trainer/otx_v2/run
304-
# - libs/telemetry_tools/**
305-
# - libs/kafka_tools/**
306-
# - Makefile.shared-python
307-
# - Makefile.shared
308-
# - .github/workflows/component.yml
284+
interactive_ai/workflows/otx_domain/trainer/otx_v2/xpu:
285+
- interactive_ai/workflows/otx_domain/trainer/otx_v2/xpu/**
286+
- interactive_ai/workflows/otx_domain/trainer/otx_v2/scripts/**
287+
- interactive_ai/workflows/otx_domain/trainer/otx_v2/tests/**
288+
- interactive_ai/workflows/otx_domain/trainer/otx_v2/download_pretrained_weights.py
289+
- interactive_ai/workflows/otx_domain/trainer/otx_v2/pyproject.toml
290+
- interactive_ai/workflows/otx_domain/trainer/otx_v2/run
291+
- libs/telemetry_tools/**
292+
- libs/kafka_tools/**
293+
- Makefile.shared-python
294+
- Makefile.shared
295+
- .github/workflows/component.yml
296+
interactive_ai/workflows/otx_domain/trainer/otx_v2/gpu:
297+
- interactive_ai/workflows/otx_domain/trainer/otx_v2/gpu/**
298+
- interactive_ai/workflows/otx_domain/trainer/otx_v2/scripts/**
299+
- interactive_ai/workflows/otx_domain/trainer/otx_v2/tests/**
300+
- interactive_ai/workflows/otx_domain/trainer/otx_v2/download_pretrained_weights.py
301+
- interactive_ai/workflows/otx_domain/trainer/otx_v2/pyproject.toml
302+
- interactive_ai/workflows/otx_domain/trainer/otx_v2/run
303+
- libs/telemetry_tools/**
304+
- libs/kafka_tools/**
305+
- Makefile.shared-python
306+
- Makefile.shared
307+
- .github/workflows/component.yml
309308

310309
# Web UI
311310
web_ui:

interactive_ai/workflows/otx_domain/trainer/otx_v2/gpu/Dockerfile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ RUN apt update \
3232
&& echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf
3333

3434
# step 2: get python dependencies
35-
FROM base AS build
35+
FROM base AS runtime
3636

3737
ENV UV_COMPILE_BYTECODE=1
3838
ENV UV_LINK_MODE=copy
@@ -44,6 +44,7 @@ ENV UV_PYTHON_DOWNLOADS=0
4444
COPY --link --from=libs . libs
4545

4646
WORKDIR /interactive_ai/workflows/otx_domain/trainer/otx_v2
47+
RUN chown -R 10001:10001 /interactive_ai/workflows/otx_domain/trainer/otx_v2
4748

4849
COPY --link --from=ghcr.io/astral-sh/uv:0.6.12@sha256:515b886e8eb99bcf9278776d8ea41eb4553a794195ef5803aa7ca6258653100d /uv /bin/uv
4950

@@ -56,9 +57,6 @@ RUN --mount=type=cache,target=/root/.cache/uv \
5657
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
5758
uv sync --frozen --no-dev --no-editable
5859

59-
# step 3: build final runtime image
60-
FROM base AS runtime
61-
6260
# Install runtime dependencies
6361
RUN apt-get update && \
6462
apt-get install -y --no-install-recommends \
@@ -71,7 +69,6 @@ RUN apt-get update && \
7169
rm -rf /root/.cache/pip
7270

7371
# Copy the application from the builder
74-
COPY --link --from=build --chown=10001 /interactive_ai/workflows/otx_domain/trainer/otx_v2 /interactive_ai/workflows/otx_domain/trainer/otx_v2
7572
COPY --link --from=cuda --chown=10001 /usr/local /usr/local
7673

7774
# Place executables in the environment at the front of the path

interactive_ai/workflows/otx_domain/trainer/otx_v2/gpu/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ style-fix: venv
2626
uv run ruff check .. --config ../pyproject.toml --fix
2727
uv run ruff format .. --config ../pyproject.toml
2828

29-
# TODO CVS-166188 remove the '-' and 'true' workaround after fixing the tests
3029
test-unit: venv
31-
-PYTHONPATH=../scripts uv run pytest ../tests --disable-warnings -v
32-
true
30+
PYTHONPATH=../scripts uv run pytest ../tests --disable-warnings -v
3331

3432
test-component:
3533
@echo "test-component not available"

interactive_ai/workflows/otx_domain/trainer/otx_v2/tests/conftest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ def fxt_async_caller():
3333
AsyncCaller().start()
3434
yield
3535
AsyncCaller().close()
36+
37+
38+
@pytest.fixture(scope="session", autouse=True)
39+
def ensure_torch_hub_checkpoints():
40+
checkpoints_dir = Path.home() / ".cache" / "torch" / "hub" / "checkpoints"
41+
checkpoints_dir.mkdir(parents=True, exist_ok=True)

interactive_ai/workflows/otx_domain/trainer/otx_v2/xpu/Dockerfile

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,11 @@ RUN apt-get purge -y --auto-remove gpg wget && \
3535
/tmp/* \
3636
/usr/share/man/* /usr/share/doc/*
3737

38-
# step 2: get python dependencies
39-
FROM base AS build
40-
4138
# Copy the service dependencies
4239
COPY --link --from=libs . libs
4340

4441
WORKDIR /interactive_ai/workflows/otx_domain/trainer/otx_v2
42+
RUN chown -R 10001:10001 /interactive_ai/workflows/otx_domain/trainer/otx_v2
4543

4644
COPY --link --from=ghcr.io/astral-sh/uv:0.6.12@sha256:515b886e8eb99bcf9278776d8ea41eb4553a794195ef5803aa7ca6258653100d /uv /bin/uv
4745

@@ -56,12 +54,6 @@ RUN --mount=type=cache,target=/root/.cache/uv uv sync --frozen --no-dev --no-edi
5654
RUN uv pip uninstall torch
5755
RUN uv pip install torch==2.7.0 --default-index https://download.pytorch.org/whl/xpu
5856

59-
# step 3: build final runtime image
60-
FROM base AS runtime
61-
62-
# Copy the application from the builder
63-
COPY --link --from=build --chown=10001 /interactive_ai/workflows/otx_domain/trainer/otx_v2 /interactive_ai/workflows/otx_domain/trainer/otx_v2
64-
6557
# Place executables in the environment at the front of the path
6658
ENV PATH="/interactive_ai/workflows/otx_domain/trainer/otx_v2/.venv/bin:/interactive_ai/workflows/otx_domain/trainer/otx_v2:$PATH"
6759
ENV PYTHONPATH="/interactive_ai/workflows/otx_domain/trainer/otx_v2"
@@ -70,4 +62,4 @@ ENV HF_HUB_OFFLINE=1
7062
USER non-root
7163

7264
WORKDIR /home/non-root
73-
WORKDIR /interactive_ai/workflows/otx_domain/trainer/otx_v2
65+
WORKDIR /interactive_ai/workflows/otx_domain/trainer/otx_v2

interactive_ai/workflows/otx_domain/trainer/otx_v2/xpu/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ style-fix: venv
2626
uv run ruff check .. --config ../pyproject.toml --fix
2727
uv run ruff format .. --config ../pyproject.toml
2828

29-
# TODO CVS-166188 remove the '-' and 'true' workaround after fixing the tests
3029
test-unit: venv
31-
-PYTHONPATH=../scripts uv run pytest ../tests --disable-warnings -v
32-
true
30+
PYTHONPATH=../scripts uv run pytest ../tests --disable-warnings -v
3331

3432
test-component:
3533
@echo "test-component not available"

0 commit comments

Comments
 (0)