From 665e67b4890482290f09b7f98f08dc943f5da55c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 14 Apr 2026 21:28:22 +0000 Subject: [PATCH 1/8] Adjust dependency pins for broken workflow builds Agent-Logs-Url: https://github.com/Shared-Reality-Lab/IMAGE-server/sessions/d7a1eb71-1cf9-4bfb-bd2c-25f50f54b20e Co-authored-by: jeffbl <2095406+jeffbl@users.noreply.github.com> --- handlers/svg-open-street-map/requirements.txt | Bin 918 -> 918 bytes preprocessors/ner/requirements.txt | 4 ++-- services/espnet-tts-fr/requirements.txt | 2 +- services/espnet-tts/requirements.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/handlers/svg-open-street-map/requirements.txt b/handlers/svg-open-street-map/requirements.txt index 276608bbc72a00549b393d750283120efe8e55fc..de4ea5cc440cef2e27e58a9f6c6a6b0923bee8cd 100644 GIT binary patch delta 18 acmbQnK8=0DH%3+?20aFY&A%CEGXelOXa&Lm delta 18 acmbQnK8=0DH%3-N20aF&&A%CEGXelOY6Zgp diff --git a/preprocessors/ner/requirements.txt b/preprocessors/ner/requirements.txt index 75816f2b..f342fac3 100644 --- a/preprocessors/ner/requirements.txt +++ b/preprocessors/ner/requirements.txt @@ -2,7 +2,7 @@ bs4==0.0.1 imgkit==1.2.2 nltk==3.7 gunicorn==23.0.0 -pillow==12.1.1 +pillow==10.4.0 torch==1.13.1 tqdm~=4.66.3 torchvision==0.8.2 @@ -10,6 +10,6 @@ clip-by-openai==1.1 scikit-learn==1.1.2 packaging==21.3 jsonschema==4.23.0 -Flask==3.1.3 +Flask==2.2.5 pycocoevalcap==1.2 git+https://github.com/openai/CLIP \ No newline at end of file diff --git a/services/espnet-tts-fr/requirements.txt b/services/espnet-tts-fr/requirements.txt index e6a7091a..3ec47b74 100644 --- a/services/espnet-tts-fr/requirements.txt +++ b/services/espnet-tts-fr/requirements.txt @@ -1,6 +1,6 @@ espnet==202207 espnet_model_zoo==0.1.7 -Flask==3.1.3 +Flask==2.2.5 gunicorn==23.0.0 jsonschema==4.4.0 parallel_wavegan==0.5.5 diff --git a/services/espnet-tts/requirements.txt b/services/espnet-tts/requirements.txt index c5e004de..7790747a 100644 --- a/services/espnet-tts/requirements.txt +++ b/services/espnet-tts/requirements.txt @@ -1,6 +1,6 @@ espnet==0.10.0 espnet_model_zoo==0.1.7 -Flask==3.1.3 +Flask==2.2.5 gunicorn==23.0.0 jsonschema==4.4.0 parallel_wavegan==0.5.4 From f074ccecd5f8c6eca93cf2052bbc622f4cb11893 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 14 Apr 2026 21:45:34 +0000 Subject: [PATCH 2/8] Upgrade NER to secure Pillow-compatible runtime Agent-Logs-Url: https://github.com/Shared-Reality-Lab/IMAGE-server/sessions/d7a1eb71-1cf9-4bfb-bd2c-25f50f54b20e Co-authored-by: jeffbl <2095406+jeffbl@users.noreply.github.com> --- preprocessors/ner/Dockerfile | 9 ++++----- preprocessors/ner/clipscore.py | 23 +++++++++++++---------- preprocessors/ner/requirements.txt | 10 ++++------ 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/preprocessors/ner/Dockerfile b/preprocessors/ner/Dockerfile index 28b8ba2a..87afb18e 100644 --- a/preprocessors/ner/Dockerfile +++ b/preprocessors/ner/Dockerfile @@ -1,12 +1,11 @@ -FROM ubuntu:20.04 +FROM python:3.11-bookworm -ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/ +ENV JAVA_HOME=/usr/lib/jvm/default-java RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y \ - openjdk-8-jdk \ - python3-pip \ - gcc \ + build-essential \ + default-jre-headless \ git \ curl \ && apt-get clean && \ diff --git a/preprocessors/ner/clipscore.py b/preprocessors/ner/clipscore.py index 57e5d2b8..09d995ed 100644 --- a/preprocessors/ner/clipscore.py +++ b/preprocessors/ner/clipscore.py @@ -13,12 +13,10 @@ import clip import torch from PIL import Image -from sklearn.preprocessing import normalize from torchvision.transforms import Compose, Resize, CenterCrop, ToTensor, Normalize import torch import tqdm import numpy as np -import sklearn.preprocessing import collections import os import pathlib @@ -35,6 +33,11 @@ from pycocoevalcap.spice.spice import Spice +def normalize_rows(values): + norms = np.linalg.norm(values, axis=1, keepdims=True) + return np.divide(values, norms, out=np.zeros_like(values), where=norms != 0) + + def get_all_metrics(refs, cands, return_per_cap=False): metrics = [] names = [] @@ -212,14 +215,14 @@ def get_clip_score(model, images, candidates, device, w=2.5): #as of numpy 1.21, normalize doesn't work properly for float16 if version.parse(np.__version__) < version.parse('1.21'): - images = sklearn.preprocessing.normalize(images, axis=1) - candidates = sklearn.preprocessing.normalize(candidates, axis=1) + images = normalize_rows(images) + candidates = normalize_rows(candidates) else: warnings.warn( 'due to a numerical instability, new numpy normalization is slightly different than paper results. ' 'to exactly replicate paper results, please use numpy version less than 1.21, e.g., 1.20.3.') - images = images / np.sqrt(np.sum(images**2, axis=1, keepdims=True)) - candidates = candidates / np.sqrt(np.sum(candidates**2, axis=1, keepdims=True)) + images = normalize_rows(images) + candidates = normalize_rows(candidates) per = w*np.clip(np.sum(images * candidates, axis=1), 0, None) return np.mean(per), per, candidates @@ -241,15 +244,15 @@ def get_refonlyclipscore(model, references, candidates, device): flattened_refs = extract_all_captions(flattened_refs, model, device) if version.parse(np.__version__) < version.parse('1.21'): - candidates = sklearn.preprocessing.normalize(candidates, axis=1) - flattened_refs = sklearn.preprocessing.normalize(flattened_refs, axis=1) + candidates = normalize_rows(candidates) + flattened_refs = normalize_rows(flattened_refs) else: warnings.warn( 'due to a numerical instability, new numpy normalization is slightly different than paper results. ' 'to exactly replicate paper results, please use numpy version less than 1.21, e.g., 1.20.3.') - candidates = candidates / np.sqrt(np.sum(candidates**2, axis=1, keepdims=True)) - flattened_refs = flattened_refs / np.sqrt(np.sum(flattened_refs**2, axis=1, keepdims=True)) + candidates = normalize_rows(candidates) + flattened_refs = normalize_rows(flattened_refs) cand_idx2refs = collections.defaultdict(list) for ref_feats, cand_idx in zip(flattened_refs, flattened_refs_idxs): diff --git a/preprocessors/ner/requirements.txt b/preprocessors/ner/requirements.txt index f342fac3..32d422de 100644 --- a/preprocessors/ner/requirements.txt +++ b/preprocessors/ner/requirements.txt @@ -2,14 +2,12 @@ bs4==0.0.1 imgkit==1.2.2 nltk==3.7 gunicorn==23.0.0 -pillow==10.4.0 -torch==1.13.1 +pillow==12.2.0 +torch==2.5.1 tqdm~=4.66.3 -torchvision==0.8.2 -clip-by-openai==1.1 -scikit-learn==1.1.2 +torchvision==0.20.1 packaging==21.3 jsonschema==4.23.0 Flask==2.2.5 pycocoevalcap==1.2 -git+https://github.com/openai/CLIP \ No newline at end of file +git+https://github.com/openai/CLIP From 1383e5bce85845c4af5afd032a939097d6717620 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 14 Apr 2026 21:48:38 +0000 Subject: [PATCH 3/8] Pin NER CLIP dependency and clean imports Agent-Logs-Url: https://github.com/Shared-Reality-Lab/IMAGE-server/sessions/d7a1eb71-1cf9-4bfb-bd2c-25f50f54b20e Co-authored-by: jeffbl <2095406+jeffbl@users.noreply.github.com> --- preprocessors/ner/clipscore.py | 1 - preprocessors/ner/requirements.txt | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/preprocessors/ner/clipscore.py b/preprocessors/ner/clipscore.py index 09d995ed..20d371d6 100644 --- a/preprocessors/ner/clipscore.py +++ b/preprocessors/ner/clipscore.py @@ -14,7 +14,6 @@ import torch from PIL import Image from torchvision.transforms import Compose, Resize, CenterCrop, ToTensor, Normalize -import torch import tqdm import numpy as np import collections diff --git a/preprocessors/ner/requirements.txt b/preprocessors/ner/requirements.txt index 32d422de..389f301e 100644 --- a/preprocessors/ner/requirements.txt +++ b/preprocessors/ner/requirements.txt @@ -10,4 +10,4 @@ packaging==21.3 jsonschema==4.23.0 Flask==2.2.5 pycocoevalcap==1.2 -git+https://github.com/openai/CLIP +git+https://github.com/openai/CLIP@d05afc436d78f1c48dc0dbf8e5980a9d471f35f6 From 97dee4dcce330874a306214c0d80ba3e7d20fdfe Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 14 Apr 2026 21:49:36 +0000 Subject: [PATCH 4/8] Document NER normalization helper Agent-Logs-Url: https://github.com/Shared-Reality-Lab/IMAGE-server/sessions/d7a1eb71-1cf9-4bfb-bd2c-25f50f54b20e Co-authored-by: jeffbl <2095406+jeffbl@users.noreply.github.com> --- preprocessors/ner/clipscore.py | 1 + 1 file changed, 1 insertion(+) diff --git a/preprocessors/ner/clipscore.py b/preprocessors/ner/clipscore.py index 20d371d6..edae0136 100644 --- a/preprocessors/ner/clipscore.py +++ b/preprocessors/ner/clipscore.py @@ -33,6 +33,7 @@ def normalize_rows(values): + """Normalize each row vector while leaving zero-norm rows as zeros.""" norms = np.linalg.norm(values, axis=1, keepdims=True) return np.divide(values, norms, out=np.zeros_like(values), where=norms != 0) From b1c6093faced565a1537f381e55ece95229fcfc7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 14 Apr 2026 21:52:22 +0000 Subject: [PATCH 5/8] Explain pinned NER CLIP commit Agent-Logs-Url: https://github.com/Shared-Reality-Lab/IMAGE-server/sessions/d7a1eb71-1cf9-4bfb-bd2c-25f50f54b20e Co-authored-by: jeffbl <2095406+jeffbl@users.noreply.github.com> --- preprocessors/ner/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/preprocessors/ner/requirements.txt b/preprocessors/ner/requirements.txt index 389f301e..f9de0141 100644 --- a/preprocessors/ner/requirements.txt +++ b/preprocessors/ner/requirements.txt @@ -10,4 +10,5 @@ packaging==21.3 jsonschema==4.23.0 Flask==2.2.5 pycocoevalcap==1.2 +# Pin the tested CLIP commit used for the Python 3.11-compatible NER build. git+https://github.com/openai/CLIP@d05afc436d78f1c48dc0dbf8e5980a9d471f35f6 From a55703cb3c24452c7b8ef7c4e8641aef01f1596e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 14 Apr 2026 21:53:32 +0000 Subject: [PATCH 6/8] Add NER normalization unit tests Agent-Logs-Url: https://github.com/Shared-Reality-Lab/IMAGE-server/sessions/d7a1eb71-1cf9-4bfb-bd2c-25f50f54b20e Co-authored-by: jeffbl <2095406+jeffbl@users.noreply.github.com> --- preprocessors/ner/test_clipscore.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 preprocessors/ner/test_clipscore.py diff --git a/preprocessors/ner/test_clipscore.py b/preprocessors/ner/test_clipscore.py new file mode 100644 index 00000000..d66b4fab --- /dev/null +++ b/preprocessors/ner/test_clipscore.py @@ -0,0 +1,23 @@ +import unittest + +import numpy as np + +from clipscore import normalize_rows + + +class NormalizeRowsTest(unittest.TestCase): + def test_normalizes_rows(self): + values = np.array([[3.0, 4.0], [5.0, 12.0]]) + normalized = normalize_rows(values) + expected = np.array([[0.6, 0.8], [5.0 / 13.0, 12.0 / 13.0]]) + np.testing.assert_allclose(normalized, expected) + + def test_preserves_zero_rows(self): + values = np.array([[0.0, 0.0], [0.0, 2.0]]) + normalized = normalize_rows(values) + expected = np.array([[0.0, 0.0], [0.0, 1.0]]) + np.testing.assert_allclose(normalized, expected) + + +if __name__ == "__main__": + unittest.main() From 2a0b5d6c2b119cfe9796f4dbea052feacf53237e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 14 Apr 2026 21:56:27 +0000 Subject: [PATCH 7/8] Upgrade NER Flask after Python 3.11 migration Agent-Logs-Url: https://github.com/Shared-Reality-Lab/IMAGE-server/sessions/d7a1eb71-1cf9-4bfb-bd2c-25f50f54b20e Co-authored-by: jeffbl <2095406+jeffbl@users.noreply.github.com> --- preprocessors/ner/clipscore.py | 4 ++-- preprocessors/ner/requirements.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/preprocessors/ner/clipscore.py b/preprocessors/ner/clipscore.py index edae0136..c54ce91d 100644 --- a/preprocessors/ner/clipscore.py +++ b/preprocessors/ner/clipscore.py @@ -32,8 +32,8 @@ from pycocoevalcap.spice.spice import Spice -def normalize_rows(values): - """Normalize each row vector while leaving zero-norm rows as zeros.""" +def normalize_rows(values: np.ndarray) -> np.ndarray: + """Normalize a 2D float array row-wise while leaving zero-norm rows as zeros.""" norms = np.linalg.norm(values, axis=1, keepdims=True) return np.divide(values, norms, out=np.zeros_like(values), where=norms != 0) diff --git a/preprocessors/ner/requirements.txt b/preprocessors/ner/requirements.txt index f9de0141..99b46409 100644 --- a/preprocessors/ner/requirements.txt +++ b/preprocessors/ner/requirements.txt @@ -8,7 +8,7 @@ tqdm~=4.66.3 torchvision==0.20.1 packaging==21.3 jsonschema==4.23.0 -Flask==2.2.5 +Flask==3.1.3 pycocoevalcap==1.2 # Pin the tested CLIP commit used for the Python 3.11-compatible NER build. git+https://github.com/openai/CLIP@d05afc436d78f1c48dc0dbf8e5980a9d471f35f6 From 62e335041254fdcb4b1147e293c771b3c99e9e7d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 14 Apr 2026 22:01:56 +0000 Subject: [PATCH 8/8] Upgrade NER torch to patched 2.6.0 Agent-Logs-Url: https://github.com/Shared-Reality-Lab/IMAGE-server/sessions/d7a1eb71-1cf9-4bfb-bd2c-25f50f54b20e Co-authored-by: jeffbl <2095406+jeffbl@users.noreply.github.com> --- preprocessors/ner/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/preprocessors/ner/requirements.txt b/preprocessors/ner/requirements.txt index 99b46409..b2a3a946 100644 --- a/preprocessors/ner/requirements.txt +++ b/preprocessors/ner/requirements.txt @@ -3,9 +3,9 @@ imgkit==1.2.2 nltk==3.7 gunicorn==23.0.0 pillow==12.2.0 -torch==2.5.1 +torch==2.6.0 tqdm~=4.66.3 -torchvision==0.20.1 +torchvision==0.21.0 packaging==21.3 jsonschema==4.23.0 Flask==3.1.3