From aed9265ec434e597d922d55215ed0d5092299b5b Mon Sep 17 00:00:00 2001 From: askxiaozhang Date: Thu, 10 Jul 2025 16:42:34 +0800 Subject: [PATCH 1/2] fixed confilct segment_anything_model --- label_studio_ml/examples/segment_anything_model/Dockerfile | 5 ++--- .../examples/segment_anything_model/requirements-base.txt | 5 ++++- .../examples/segment_anything_model/requirements.txt | 1 - 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/label_studio_ml/examples/segment_anything_model/Dockerfile b/label_studio_ml/examples/segment_anything_model/Dockerfile index e660289e..4185a8ba 100644 --- a/label_studio_ml/examples/segment_anything_model/Dockerfile +++ b/label_studio_ml/examples/segment_anything_model/Dockerfile @@ -1,4 +1,3 @@ -# syntax=docker/dockerfile:1 ARG PYTHON_VERSION=3.10 FROM python:${PYTHON_VERSION}-slim AS python-base @@ -34,8 +33,8 @@ RUN bash /app/download_models.sh COPY requirements-base.txt . RUN --mount=type=cache,target=${PIP_CACHE_DIR},sharing=locked \ pip install --upgrade pip && \ - pip install -r requirements-base.txt - + pip install gunicorn==22.0.0 pillow==10.3.0 && \ + pip install --no-deps "label-studio-ml @ git+https://github.com/HumanSignal/label-studio-ml-backend.git" # install custom requirements COPY requirements.txt . RUN --mount=type=cache,target=${PIP_CACHE_DIR},sharing=locked \ diff --git a/label_studio_ml/examples/segment_anything_model/requirements-base.txt b/label_studio_ml/examples/segment_anything_model/requirements-base.txt index 68ce357c..3bdc66fa 100644 --- a/label_studio_ml/examples/segment_anything_model/requirements-base.txt +++ b/label_studio_ml/examples/segment_anything_model/requirements-base.txt @@ -1,2 +1,5 @@ gunicorn==22.0.0 -label-studio-ml @ git+https://github.com/HumanSignal/label-studio-ml-backend.git \ No newline at end of file +# 安装时禁用依赖解析,防止自动装 pillow 和 label-studio-sdk +label-studio-ml @ git+https://github.com/HumanSignal/label-studio-ml-backend.git +pillow==10.3.0 +flask>=2.3,<3.2 diff --git a/label_studio_ml/examples/segment_anything_model/requirements.txt b/label_studio_ml/examples/segment_anything_model/requirements.txt index 84129332..893d26f1 100644 --- a/label_studio_ml/examples/segment_anything_model/requirements.txt +++ b/label_studio_ml/examples/segment_anything_model/requirements.txt @@ -10,6 +10,5 @@ timm==0.4.12 segment_anything @ git+https://github.com/facebookresearch/segment-anything.git mobile-sam @ git+https://github.com/ChaoningZhang/MobileSAM.git -label-studio-ml @ git+https://github.com/heartexlabs/label-studio-ml-backend.git numpy<2 From ff435c389d8d46e156a73814271b0541e50f19bb Mon Sep 17 00:00:00 2001 From: askxiaozhang Date: Fri, 11 Jul 2025 09:48:38 +0800 Subject: [PATCH 2/2] fixed-segment-model-dependency-confilict --- .../data/server/models/cache.db | Bin 0 -> 12288 bytes .../segment_anything_model/docker-compose.yml | 14 +++++++------- .../segment_anything_model/requirements.txt | 6 ++++++ 3 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 label_studio_ml/examples/segment_anything_model/data/server/models/cache.db diff --git a/label_studio_ml/examples/segment_anything_model/data/server/models/cache.db b/label_studio_ml/examples/segment_anything_model/data/server/models/cache.db new file mode 100644 index 0000000000000000000000000000000000000000..cdef091c1713285d7951a42b183909089cd1c211 GIT binary patch literal 12288 zcmeHM+in|07+&W9C{k-8R7FB+HQEwLL~O6KZBSi1B8g%V#VsWXhzcQV>>bE5<{h}?pV_nRB(6{{D6@{U-ktyW{onjEtKI*qK{-Jk z=Jhd0ruM#;%W0n@q-okq_)fz&I&$!1Cc1#LxW4LmsTJF~8~MMrshh90o3Hb~U!|bN z6#@zYg@8gpA)pXY2q**;0tx|zfI>ha@P-IHXSsJ578Y_ZY8np`jDIsi6Jyr@Ce%jG9)@y z@X6lJqm8|%Xm|T5T1tXhLEvh6L}Ph*>Yat!LQbQOMNa%5YYY)9^9FoH-FwW*IexR#A@2O1qyBEbZGZX=eVm^5S&k40zdRkZ{YVDLd4fskj`1t z!F@6Eolg6>OZ4yIE_K`i_r=XbaYv5Aprpw`V9puXc63Wv4@{g38!`-OL$5QBbUik3 zEa6gwA6_MLP0YC`q|egQ;!?U3wzF1Ri4_>TTdx~%=;vAc8U2)BkQ&lAtnxj})X&d_ z1;A`oh7y6cOHQ8vUHMypo8QMC7jSZKKtwr)fT-6o1|VU;@3G?@$EJ?tjTE08-mBag z2FCUJMQ)-hn3*cU1mUp5dOL`^i@fp9}ZU%Q!?pyf6lf`mT+^ zf5#>#fstnepVQ7M_;WaMcm??`Zj(Zb@MA)pwBJIDanAY`v-r2o2_0#4C8%q65Do5)2Ht*h#_fVT&CD6lgWf+v~RQlCgrq zzhZegkmlrs7qCsc09+d~B;IiBMNYX*LWrUeLyV&`n5H?RCQF}DD{$sQ{&BuzAP8^8 zV19Nf6c0M^iL%b1VWw(e`<;Re#?M3}Ap?ZqBhi+WkPD5hcA6N+)Z#r6xv>~{>k-=R z0UJysPG(H0EXx`jTv)2}xoRn%3v+UIptg;D|1qqbHC;>&T}+dak(jq~c&vb6T{sHk zU%;yB9YCd#T=iPI*(|ct-?XpK~S4UJf=UULoMF7DeS9tO21bFHUu#F_9FvCKL zYAJRTDUC!fRrK}9WNf>d+CGG#i46wgEWjdI|0Ag2VlLR)f>oTxRuTtr(oZ66|c z;JGk!#hw_!R>Kur4ZjpGcZdR!5d3k*>=yQlXf@JI@GK?p1O-Pu;*pqIBInq&B!}=8 zOt*v@P_B}QFhOi$sw5Q2Zk7_308Ck$Ah}5x;qPUfNo!4I>AiO z1d}x#?o}=~T`gtvP9VG<(wYAe(#0(Hua|YPAK7pGgmwVbzoy+ttAf4S<#f1=X&Gx` z-v@iN%dJ(DW)P$|0lSiJ2UByTyA7?M(E_z29`Zu$f?ghV?vKLD9~tXMGfVv5f(@6) z?C6&4-znG8&+rTn@=KFE%+KZj(5CaRwES=RSNXpt(NHo90fm4Wx8M!+)X*Dh?ZpQ(^NYFc8>QRe|JFzhAI{91AUNi=^__nJs$B2Y literal 0 HcmV?d00001 diff --git a/label_studio_ml/examples/segment_anything_model/docker-compose.yml b/label_studio_ml/examples/segment_anything_model/docker-compose.yml index d5f5aecb..970e2804 100644 --- a/label_studio_ml/examples/segment_anything_model/docker-compose.yml +++ b/label_studio_ml/examples/segment_anything_model/docker-compose.yml @@ -17,16 +17,16 @@ services: reservations: memory: 4G # Add this to pass through 1 GPU -# devices: -# - driver: nvidia -# count: 1 -# capabilities: [gpu] + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] environment: # specify these parameters if you want to use basic auth for the model server - BASIC_AUTH_USER= - BASIC_AUTH_PASS= # Change this to your model name: MobileSAM or SAM - - SAM_CHOICE=MobileSAM + - SAM_CHOICE=SAM - LOG_LEVEL=DEBUG # Enable this to use the GPU # - NVIDIA_VISIBLE_DEVICES=all @@ -41,8 +41,8 @@ services: # Do not use 'localhost' as it does not work within Docker containers. # Use prefix 'http://' or 'https://' for the URL always. # Determine the actual IP using 'ifconfig' (Linux/Mac) or 'ipconfig' (Windows). - - LABEL_STUDIO_HOST= - - LABEL_STUDIO_ACCESS_TOKEN= + - LABEL_STUDIO_HOST=http://192.168.110.208:8080 + - LABEL_STUDIO_ACCESS_TOKEN=9c65451a1335c0977d62978df63b6d42c5c5f86c ports: - 9090:9090 diff --git a/label_studio_ml/examples/segment_anything_model/requirements.txt b/label_studio_ml/examples/segment_anything_model/requirements.txt index 893d26f1..aa8bdd0c 100644 --- a/label_studio_ml/examples/segment_anything_model/requirements.txt +++ b/label_studio_ml/examples/segment_anything_model/requirements.txt @@ -7,8 +7,14 @@ torchvision==0.15.2 gunicorn==22.0.0 rq==1.10.1 timm==0.4.12 +flask>=2.3,<3.2 +pydantic segment_anything @ git+https://github.com/facebookresearch/segment-anything.git mobile-sam @ git+https://github.com/ChaoningZhang/MobileSAM.git numpy<2 + +label-studio-sdk @ git+https://github.com/HumanSignal/label-studio-sdk.git +colorama +semver