Skip to content

Commit 63fe721

Browse files
committed
Merge branch 'master' into flair
2 parents de03a56 + 5c74411 commit 63fe721

File tree

35 files changed

+496
-384
lines changed

35 files changed

+496
-384
lines changed

.github/docker-build-config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,5 @@
4343
backend_tag_prefix: spacy-
4444
- backend_dir_name: tesseract
4545
backend_tag_prefix: tesseract-
46+
- backend_dir_name: yolo
47+
backend_tag_prefix: yolo-

.github/workflows/build.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ on:
66
- master
77
paths:
88
- ".github/workflows/build.yml"
9-
- "label_studio_ml/examples"
9+
- "label_studio_ml/examples/**"
10+
workflow_dispatch:
1011

1112
env:
1213
DOCKER_BUILD_CONFIG_BRANCH: "master"
@@ -61,8 +62,8 @@ jobs:
6162
run: |
6263
set -xueo pipefail
6364
MAX_TAG_LENGTH=50
64-
pretty_branch_name="$(echo -n "${BRANCH_NAME#refs/heads/}" | sed 's#/#-#g' | sed 's#_#-#g'| sed 's#\.#-#g' | tr '[:upper:]' '[:lower:]')"
65-
echo "pretty_branch_name=$pretty_branch_name" >> $GITHUB_OUTPUT
65+
pretty_branch_name="$(echo -n "${BRANCH_NAME#refs/heads/}" | sed -E 's#[/_\.-]+#-#g' | tr '[:upper:]' '[:lower:]' | cut -c1-25 | sed -E 's#-$##g')"
66+
echo "pretty_branch_name=${pretty_branch_name}" >> "${GITHUB_OUTPUT}"
6667
timestamp="$(date +'%Y%m%d.%H%M%S')"
6768
echo "timestamp=$timestamp" >> $GITHUB_OUTPUT
6869
short_sha="$(git rev-parse --short HEAD)"
@@ -80,7 +81,7 @@ jobs:
8081
echo "image_branch_version=$image_branch_version" >> $GITHUB_OUTPUT
8182
8283
- name: Set up Docker Buildx
83-
uses: docker/setup-buildx-action@v3.7.1
84+
uses: docker/setup-buildx-action@v3.8.0
8485

8586
- name: Login to DockerHub
8687
if: ${{ !github.event.pull_request.head.repo.fork }}
@@ -109,7 +110,7 @@ jobs:
109110
core.setOutput("tags", tags);
110111
111112
- name: Push Docker image
112-
uses: docker/build-push-action@v6.9.0
113+
uses: docker/build-push-action@v6.13.0
113114
id: docker_build_and_push
114115
with:
115116
context: "${{ env.DOCKER_EXAMPLES_DIRECTORY }}/${{ env.backend_dir_name }}"

.github/workflows/pr-labeler.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ jobs:
2020
pull-requests: write
2121
steps:
2222
- uses: hmarr/[email protected]
23-
- uses: thehanimo/[email protected].2
23+
- uses: thehanimo/[email protected].3
2424
name: "Validate PR's title"
2525
with:
2626
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2727
pass_on_octokit_error: false
2828
configuration_path: ".github/pr-title-checker-config.json"
29-
- uses: release-drafter/release-drafter@v6.0.0
29+
- uses: release-drafter/release-drafter@v6.1.0
3030
name: "Set PR's label based on title"
3131
with:
3232
disable-releaser: true

.github/workflows/tests.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ on:
1818
- 'release/**'
1919
paths-ignore:
2020
- '**/*.md' # Ignore changes to all .md files
21+
schedule:
22+
- cron: '0 6 * * 1'
23+
workflow_dispatch:
2124

2225
env:
2326
CACHE_NAME_PREFIX: v1
@@ -88,48 +91,53 @@ jobs:
8891
env:
8992
DOCKER_BUILDKIT: 1
9093
TEST_ENV: "true"
91-
run: docker compose -f label_studio_ml/examples/${{ matrix.backend_dir_name }}/docker-compose.yml up -d --build
94+
run: docker compose -f label_studio_ml/examples/${{ matrix.backend_dir_name }}/docker-compose.yml up ${{ matrix.skip_pytests != 'true' && '' || '-d' }} --build
9295

9396
- name: Wait for stack
97+
if: ${{ matrix.skip_pytests != 'true' }}
9498
timeout-minutes: 20
9599
run: |
96100
while [ "$(curl -s -o /dev/null -L -w ''%{http_code}'' "http://localhost:9090/health")" != "200" ]; do
97101
echo "=> Waiting for service to become available" && sleep 2s
98102
done
99103
100104
- name: Run general functional tests
105+
if: ${{ matrix.skip_pytests != 'true' }}
101106
env:
102107
ML_BACKEND: ${{ matrix.backend_dir_name }}
103108
run: |
104109
pytest tests/ -vvv --ignore-glob='**/logs/*' --ignore-glob='**/data/*' --cov=. --cov-report=xml:tests/${{ matrix.backend_dir_name }}_coverage.xml
105110
106111
- name: Run per-ml-backend tests
112+
if: ${{ matrix.skip_pytests != 'true' }}
107113
env:
108114
ML_BACKEND: ${{ matrix.backend_dir_name }}
109115
run: |
110116
docker compose -f label_studio_ml/examples/${{ matrix.backend_dir_name }}/docker-compose.yml exec -T ${{ matrix.backend_dir_name }} pytest -vvv --cov --cov-report=xml:/tmp/coverage.xml
111117
112118
- name: Copy per-ml-backend coverage.xml from the container
119+
if: ${{ matrix.skip_pytests != 'true' }}
113120
run: |
114121
docker compose -f label_studio_ml/examples/${{ matrix.backend_dir_name }}/docker-compose.yml cp ${{ matrix.backend_dir_name }}:/tmp/coverage.xml label_studio_ml/examples/${{ matrix.backend_dir_name }}/coverage.xml
115122
116123
- name: Pull the logs
117-
if: always()
124+
if: always() && matrix.skip_pytests != 'true'
118125
env:
119126
DOCKER_BUILDKIT: 1
120127
run: docker compose -f label_studio_ml/examples/${{ matrix.backend_dir_name }}/docker-compose.yml logs
121128

122129
- name: "Upload general coverage to Codecov"
123130
if: ${{ matrix.backend_dir_name == 'the_simplest_backend' }}
124-
uses: codecov/codecov-action@v4.6.0
131+
uses: codecov/codecov-action@v5.3.1
125132
with:
126133
name: codecov-general
127134
files: ./tests/${{ matrix.backend_dir_name }}_coverage.xml
128135
token: ${{ secrets.CODECOV_TOKEN }}
129136
fail_ci_if_error: false
130137

131138
- name: "Upload ml-backend ${{ matrix.backend_dir_name }} coverage to Codecov"
132-
uses: codecov/[email protected]
139+
if: ${{ matrix.backend_dir_name == 'the_simplest_backend' }}
140+
uses: codecov/[email protected]
133141
with:
134142
name: codecov-${{ matrix.backend_dir_name }}
135143
files: ./label_studio_ml/examples/${{ matrix.backend_dir_name }}/coverage.xml
@@ -151,7 +159,7 @@ jobs:
151159
uses: actions/github-script@v7
152160
env:
153161
BASE_REF: "${{ github.event.pull_request.base.sha || github.event.before }}"
154-
HEAD_REF: "${{ github.event.pull_request.head.sha || github.event.after }}"
162+
HEAD_REF: "${{ github.event.pull_request.head.sha || github.event.after || github.sha }}"
155163
EVENT_NAME: "${{ github.event_name }}"
156164
with:
157165
script: |
@@ -176,7 +184,7 @@ jobs:
176184
const docker_build_config = yaml.load(docker_build_config_content);
177185
178186
let backends = [];
179-
if (event_name === 'push') {
187+
if (event_name === 'schedule' || event_name === 'workflow_dispatch') {
180188
const {data: examples} = await github.rest.repos.getContent({
181189
owner: owner,
182190
repo: repo,
@@ -198,19 +206,21 @@ jobs:
198206
for (const backend of backends) {
199207
const config = docker_build_config.find(e => e.backend_dir_name === backend)
200208
let runs_on = "ubuntu-latest";
209+
let skip_pytests = "false";
201210
if (config) {
202211
console.log(`Config for ${backend}:`);
203212
console.log(config);
204213
if ((config.bypass ?? []).includes("pytests")) {
205214
console.log(`Skipping pytests for ${backend}`);
206-
continue;
215+
skip_pytests = "true";
207216
}
208217
runs_on = config.runs_on ?? "ubuntu-latest";
209218
} else {
210219
console.log(`Could not find config for ${backend}`);
211220
}
212-
matrixInclude.push({"backend_dir_name": backend, "runs_on": runs_on});
221+
matrixInclude.push({"backend_dir_name": backend, "runs_on": runs_on, "skip_pytests": skip_pytests});
213222
}
223+
console.log(`Matrix calculation result:`);
214224
console.log(matrixInclude);
215225
core.setOutput("matrix-include", matrixInclude);
216226

label_studio_ml/examples/bert_classifier/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ services:
44
bert_classifier:
55
container_name: bert_classifier
66
image: heartexlabs/label-studio-ml-backend:bertclass-master
7+
init: true
78
build:
89
context: .
910
args:

label_studio_ml/examples/easyocr/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ services:
44
easyocr:
55
container_name: easyocr
66
image: heartexlabs/label-studio-ml-backend:easyocr-master
7+
init: true
78
build:
89
context: .
910
args:

label_studio_ml/examples/flair/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ services:
44
flair:
55
container_name: flair
66
image: heartexlabs/label-studio-ml-backend:flair-master
7+
init: true
78
build:
89
context: .
910
args:

label_studio_ml/examples/grounding_dino/Dockerfile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM pytorch/pytorch:2.1.2-cuda12.1-cudnn8-runtime
1+
FROM pytorch/pytorch:2.1.2-cuda12.1-cudnn8-devel
22
ARG DEBIAN_FRONTEND=noninteractive
33
ARG TEST_ENV
44

@@ -12,7 +12,7 @@ RUN --mount=type=cache,target="/var/cache/apt",sharing=locked \
1212
&& apt-get install -y git \
1313
&& apt-get install -y wget \
1414
&& apt-get install -y g++ freeglut3-dev build-essential libx11-dev \
15-
libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev libfreeimage-dev \
15+
libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev libfreeimage-dev ninja-build \
1616
&& apt-get -y install ffmpeg libsm6 libxext6 libffi-dev python3-dev python3-pip gcc
1717

1818
ENV PYTHONUNBUFFERED=1 \
@@ -23,10 +23,8 @@ ENV PYTHONUNBUFFERED=1 \
2323
THREADS=4 \
2424
CUDA_HOME=/usr/local/cuda \
2525
GROUNDINGDINO_REPO_PATH=/GroundingDINO
26-
27-
RUN conda install -c "nvidia/label/cuda-12.1.1" cuda -y
28-
ENV CUDA_HOME=/opt/conda \
29-
TORCH_CUDA_ARCH_LIST="6.0;6.1;7.0;7.5;8.0;8.6+PTX;8.9;9.0"
26+
ENV PATH="${CUDA_HOME}/bin:${PATH}"
27+
ENV TORCH_CUDA_ARCH_LIST="6.0;6.1;7.0;7.5;8.0;8.6+PTX;8.9;9.0"
3028

3129
COPY requirements.txt .
3230
RUN --mount=type=cache,target=${PIP_CACHE_DIR},sharing=locked \

label_studio_ml/examples/grounding_dino/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ services:
44
grounding_dino:
55
container_name: grounding_dino
66
image: heartexlabs/label-studio-ml-backend:grnddino-master
7+
init: true
78
build:
89
context: .
910
args:

label_studio_ml/examples/grounding_sam/Dockerfile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM pytorch/pytorch:2.1.2-cuda12.1-cudnn8-runtime
1+
FROM pytorch/pytorch:2.1.2-cuda12.1-cudnn8-devel
22
ARG DEBIAN_FRONTEND=noninteractive
33
ARG TEST_ENV
44

@@ -12,7 +12,7 @@ RUN --mount=type=cache,target="/var/cache/apt",sharing=locked \
1212
&& apt-get install -y git \
1313
&& apt-get install -y wget \
1414
&& apt-get install -y g++ freeglut3-dev build-essential libx11-dev \
15-
libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev libfreeimage-dev \
15+
libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev libfreeimage-dev ninja-build \
1616
&& apt-get -y install ffmpeg libsm6 libxext6 libffi-dev python3-dev python3-pip gcc
1717

1818
ENV PYTHONUNBUFFERED=1 \
@@ -23,10 +23,8 @@ ENV PYTHONUNBUFFERED=1 \
2323
THREADS=4 \
2424
CUDA_HOME=/usr/local/cuda \
2525
GROUNDINGDINO_REPO_PATH=/GroundingDINO
26-
27-
RUN conda install -c "nvidia/label/cuda-12.1.1" cuda -y
28-
ENV CUDA_HOME=/opt/conda \
29-
TORCH_CUDA_ARCH_LIST="6.0;6.1;7.0;7.5;8.0;8.6+PTX;8.9;9.0"
26+
ENV PATH="${CUDA_HOME}/bin:${PATH}"
27+
ENV TORCH_CUDA_ARCH_LIST="6.0;6.1;7.0;7.5;8.0;8.6+PTX;8.9;9.0"
3028

3129
COPY requirements.txt .
3230
RUN --mount=type=cache,target=${PIP_CACHE_DIR},sharing=locked \

0 commit comments

Comments
 (0)