User Details
- User Since
- Aug 3 2019, 6:58 AM (249 w, 3 d)
- Availability
- Available
- IRC Nick
- kevinbazira
- LDAP User
- Kevin Bazira
- MediaWiki User
- KBazira (WMF) [ Global Accounts ]
Today
Hi @mfossati, the ML team believes it would be more appropriate for the LiftWing API to set a maximum limit rather than receiving it as part of the input. In T363506#9782636, you mentioned the possibility of dispatching different requests if the limit is exceeded, which the team finds acceptable. Would you like to proceed with this approach?
During the meeting between the Structured Content team and ML team, it was concluded that passing image objects is preferable to passing image URLs. This is because passing image URLs raises security concerns related to sharing a user cookie, as discussed in T362749.
Yesterday
Work on this task has been paused for now as the ML team, Structured Content team, and Data Persistence team discuss the best solution to access images from the Wikimedia Commons UploadStash that doesn't compromise privacy, reliability, and security.
Thu, May 9
Thank you for dedicating a task to investigate the feasibility of this solution.
Regarding image sizes, at the moment Wikimedia Commons cannot serve a file larger than 1MB from the UploadStash. I am getting the following error:
To reproduce this, please follow the steps below:
- visit the Commons UploadWizard: https://commons.wikimedia.org/wiki/Special:UploadWizard
- use the UploadWizard to upload an image that is above 2MBs but don't publish it
- visit the Commons UploadStash: https://commons.wikimedia.org/wiki/Special:UploadStash
- copy URL of stash key and try to access it in a new tab. you'll get the an internal server error: Cannot serve a file larger than 1048576 bytes.
Wed, May 8
As discussed in today's meeting, adding image objects to the API request significantly increases the payload size. See sample payloads in P62085. If one user sends a request with 50 image URLs and another sends a request with 50 serialized images objects, the latter is likely to exceed the server's request body size limit faster.
Tue, May 7
@mfossati and I were able to download images that we uploaded to the commons stash by using the stash file URL and a cookie as shown in the function below:
import requests
Mon, May 6
As we work to enable the logo-detection model-server to access images from the upload stash using a k8s endpoint, @achou pointed out that files might not be accessible since the upload stash docs state: files not be public, and only writable/accessible by the uploader.
I was able to reproduce this issue using the steps below:
- visit the Commons UploadWizard: https://commons.wikimedia.org/wiki/Special:UploadWizard
- use the UploadWizard to upload an image but don't publish it
- visit Commons UploadStash: https://commons.wikimedia.org/wiki/Special:UploadStash
- copy URL of stash key and try to access it in incognito. it's not publicly accessible.
Thank you for the confirmation, @elukey! Since we are working towards implementing the new transparent proxy config for all isvcs, the logo-detection isvc can start using it straightaway and keep the mw-api-int-ro config as a contingency.
Fri, May 3
Hi @elukey, following the recent switch from api-ro to mw-api-int-ro in T362316. If we wanted to enable the logo-detection model-server hosted on LiftWing to access the external URL below:
http://commons.wikimedia.org/w/index.php?title=Special:FilePath&file=Cambia_logo.png&width=224
Please confirm whether the following URL would be the correct k8s internal endpoint:
http://mw-api-int-ro.discovery.wmnet:4680/w/index.php?title=Special:FilePath&file=Cambia_logo.png&width=224
when used with the commons.wikimedia.org host header. Thanks!
Thu, May 2
Tue, Apr 30
Fri, Apr 26
A restriction has been added to the model-server to enable it process images from trusted domains that host Wikimedia Commons images as shown in the requests below:
1.Request A: passes because it uses a trusted domain
$ curl -s localhost:8080/v1/models/logo-detection:predict -X POST -d '{"instances": [ { "filename": "Cambia_logo.png", "url": "http://commons.wikimedia.org/w/index.php?title=Special:FilePath&file=Cambia_logo.png&width=224", "target": "logo" } ] }' -i --header "Content-type: application/json" HTTP/1.1 200 OK date: Fri, 26 Apr 2024 08:24:54 GMT server: uvicorn content-length: 101 content-type: application/json
Support for building and running the logo-detection model-server using the Makefile was added and it can be tested using:
# first terminal $ make logo-detection
Thu, Apr 25
Thank you for sharing instructions to replicate this issue @isarantopoulos, I've run the same commands in the ml-sandbox and had no lack reproducing the issue:
kevinbazira@ml-sandbox:~$ docker run -p 8080:8080 -it --entrypoint /bin/bash docker-registry.wikimedia.org/bookworm:20240414 root@e653a650a622:/# apt-get update && apt-get upgrade -y && apt-get install python3 git make ca-certificates python3-venv wget -y Get:1 http://mirrors.wikimedia.org/debian bookworm InRelease [151 kB] Get:2 http://apt.wikimedia.org/wikimedia bookworm-wikimedia InRelease [57.9 kB] Get:3 http://mirrors.wikimedia.org/debian bookworm-updates InRelease [55.4 kB] Get:4 http://mirrors.wikimedia.org/debian bookworm-backports InRelease [56.5 kB] Get:5 http://security.debian.org/debian-security bookworm-security InRelease [48.0 kB] Get:6 http://mirrors.wikimedia.org/debian bookworm/main amd64 Packages [8786 kB] Get:7 http://mirrors.wikimedia.org/debian bookworm-updates/main amd64 Packages [13.8 kB] Get:8 http://mirrors.wikimedia.org/debian bookworm-backports/main amd64 Packages [192 kB] Get:9 http://mirrors.wikimedia.org/debian bookworm-backports/contrib amd64 Packages [5372 B] Get:10 http://apt.wikimedia.org/wikimedia bookworm-wikimedia/main amd64 Packages [55.4 kB] Get:11 http://security.debian.org/debian-security bookworm-security/main amd64 Packages [155 kB] Fetched 9577 kB in 2s (5698 kB/s) Reading package lists... Done Reading package lists... Done Building dependency tree... Done Reading state information... Done Calculating upgrade... Done The following packages will be upgraded: libc-bin libc6 2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 3359 kB of archives. After this operation, 4096 B of additional disk space will be used. Get:1 http://security.debian.org/debian-security bookworm-security/main amd64 libc6 amd64 2.36-9+deb12u6 [2753 kB] Get:2 http://security.debian.org/debian-security bookworm-security/main amd64 libc-bin amd64 2.36-9+deb12u6 [607 kB] Fetched 3359 kB in 0s (17.5 MB/s) debconf: delaying package configuration, since apt-utils is not installed (Reading database ... 6090 files and directories currently installed.) Preparing to unpack .../libc6_2.36-9+deb12u6_amd64.deb ... debconf: unable to initialize frontend: Dialog debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 78.) debconf: falling back to frontend: Readline debconf: unable to initialize frontend: Readline debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.36.0 /usr/local/share/perl/5.36.0 /usr/lib/x86_64-linux-gnu/perl5/5.36 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.36 /usr/share/perl/5.36 /usr/local/lib/site_perl) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.) debconf: falling back to frontend: Teletype Unpacking libc6:amd64 (2.36-9+deb12u6) over (2.36-9+deb12u4) ... Setting up libc6:amd64 (2.36-9+deb12u6) ... debconf: unable to initialize frontend: Dialog debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 78.) debconf: falling back to frontend: Readline debconf: unable to initialize frontend: Readline debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.36.0 /usr/local/share/perl/5.36.0 /usr/lib/x86_64-linux-gnu/perl5/5.36 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.36 /usr/share/perl/5.36 /usr/local/lib/site_perl) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.) debconf: falling back to frontend: Teletype (Reading database ... 6090 files and directories currently installed.) Preparing to unpack .../libc-bin_2.36-9+deb12u6_amd64.deb ... Unpacking libc-bin (2.36-9+deb12u6) over (2.36-9+deb12u4) ... Setting up libc-bin (2.36-9+deb12u6) ... Reading package lists... Done Building dependency tree... Done Reading state information... Done The following additional packages will be installed: git-man libbrotli1 libcurl3-gnutls liberror-perl libexpat1 libgdbm-compat4 libgdbm6 libgssapi-krb5-2 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libldap-2.5-0 libncursesw6 libnghttp2-14 libnsl2 libperl5.36 libpsl5 libpython3-stdlib libpython3.11-minimal libpython3.11-stdlib libreadline8 librtmp1 libsasl2-2 libsasl2-modules-db libsqlite3-0 libssh2-1 libssl3 libtirpc-common libtirpc3 media-types openssl perl perl-modules-5.36 python3-distutils python3-lib2to3 python3-minimal python3-pip-whl python3-setuptools-whl python3.11 python3.11-minimal python3.11-venv readline-common Suggested packages: gettext-base git-daemon-run | git-daemon-sysvinit git-doc git-email git-gui gitk gitweb git-cvs git-mediawiki git-svn gdbm-l10n krb5-doc krb5-user sensible-utils make-doc perl-doc libterm-readline-gnu-perl | libterm-readline-perl-perl libtap-harness-archive-perl python3-doc python3-tk python3.11-doc binutils binfmt-support readline-doc Recommended packages: patch less ssh-client krb5-locales libldap-common libgpm2 publicsuffix libsasl2-modules netbase The following NEW packages will be installed: ca-certificates git git-man libbrotli1 libcurl3-gnutls liberror-perl libexpat1 libgdbm-compat4 libgdbm6 libgssapi-krb5-2 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libldap-2.5-0 libncursesw6 libnghttp2-14 libnsl2 libperl5.36 libpsl5 libpython3-stdlib libpython3.11-minimal libpython3.11-stdlib libreadline8 librtmp1 libsasl2-2 libsasl2-modules-db libsqlite3-0 libssh2-1 libssl3 libtirpc-common libtirpc3 make media-types openssl perl perl-modules-5.36 python3 python3-distutils python3-lib2to3 python3-minimal python3-pip-whl python3-setuptools-whl python3-venv python3.11 python3.11-minimal python3.11-venv readline-common wget 0 upgraded, 49 newly installed, 0 to remove and 0 not upgraded. Need to get 33.3 MB of archives. After this operation, 145 MB of additional disk space will be used. Get:1 http://mirrors.wikimedia.org/debian bookworm/main amd64 perl-modules-5.36 all 5.36.0-7+deb12u1 [2815 kB] Get:2 http://mirrors.wikimedia.org/debian bookworm/main amd64 libgdbm6 amd64 1.23-3 [72.2 kB] Get:3 http://mirrors.wikimedia.org/debian bookworm/main amd64 libgdbm-compat4 amd64 1.23-3 [48.2 kB] Get:4 http://mirrors.wikimedia.org/debian bookworm/main amd64 libperl5.36 amd64 5.36.0-7+deb12u1 [4218 kB] Get:5 http://mirrors.wikimedia.org/debian bookworm/main amd64 perl amd64 5.36.0-7+deb12u1 [239 kB] Get:6 http://mirrors.wikimedia.org/debian bookworm/main amd64 libssl3 amd64 3.0.11-1~deb12u2 [2019 kB] Get:7 http://mirrors.wikimedia.org/debian bookworm/main amd64 libpython3.11-minimal amd64 3.11.2-6 [813 kB] Get:8 http://mirrors.wikimedia.org/debian bookworm/main amd64 libexpat1 amd64 2.5.0-1 [99.3 kB] Get:9 http://mirrors.wikimedia.org/debian bookworm/main amd64 python3.11-minimal amd64 3.11.2-6 [2064 kB] Get:10 http://mirrors.wikimedia.org/debian bookworm/main amd64 python3-minimal amd64 3.11.2-1+b1 [26.3 kB] Get:11 http://mirrors.wikimedia.org/debian bookworm/main amd64 media-types all 10.0.0 [26.1 kB] Get:12 http://mirrors.wikimedia.org/debian bookworm/main amd64 libncursesw6 amd64 6.4-4 [134 kB] Get:13 http://mirrors.wikimedia.org/debian bookworm/main amd64 libkrb5support0 amd64 1.20.1-2+deb12u1 [32.4 kB] Get:14 http://mirrors.wikimedia.org/debian bookworm/main amd64 libk5crypto3 amd64 1.20.1-2+deb12u1 [78.9 kB] Get:15 http://mirrors.wikimedia.org/debian bookworm/main amd64 libkeyutils1 amd64 1.6.3-2 [8808 B] Get:16 http://mirrors.wikimedia.org/debian bookworm/main amd64 libkrb5-3 amd64 1.20.1-2+deb12u1 [332 kB] Get:17 http://mirrors.wikimedia.org/debian bookworm/main amd64 libgssapi-krb5-2 amd64 1.20.1-2+deb12u1 [134 kB] Get:18 http://mirrors.wikimedia.org/debian bookworm/main amd64 libtirpc-common all 1.3.3+ds-1 [14.0 kB] Get:19 http://mirrors.wikimedia.org/debian bookworm/main amd64 libtirpc3 amd64 1.3.3+ds-1 [85.2 kB] Get:20 http://mirrors.wikimedia.org/debian bookworm/main amd64 libnsl2 amd64 1.3.0-2 [39.5 kB] Get:21 http://mirrors.wikimedia.org/debian bookworm/main amd64 readline-common all 8.2-1.3 [69.0 kB] Get:22 http://mirrors.wikimedia.org/debian bookworm/main amd64 libreadline8 amd64 8.2-1.3 [166 kB] Get:23 http://mirrors.wikimedia.org/debian bookworm/main amd64 libsqlite3-0 amd64 3.40.1-2 [837 kB] Get:24 http://mirrors.wikimedia.org/debian bookworm/main amd64 libpython3.11-stdlib amd64 3.11.2-6 [1796 kB] Get:25 http://mirrors.wikimedia.org/debian bookworm/main amd64 python3.11 amd64 3.11.2-6 [572 kB] Get:26 http://mirrors.wikimedia.org/debian bookworm/main amd64 libpython3-stdlib amd64 3.11.2-1+b1 [9312 B] Get:27 http://mirrors.wikimedia.org/debian bookworm/main amd64 python3 amd64 3.11.2-1+b1 [26.3 kB] Get:28 http://mirrors.wikimedia.org/debian bookworm/main amd64 openssl amd64 3.0.11-1~deb12u2 [1419 kB] Get:29 http://mirrors.wikimedia.org/debian bookworm/main amd64 ca-certificates all 20230311 [153 kB] Get:30 http://mirrors.wikimedia.org/debian bookworm/main amd64 libpsl5 amd64 0.21.2-1 [58.7 kB] Get:31 http://mirrors.wikimedia.org/debian bookworm/main amd64 wget amd64 1.21.3-1+b2 [984 kB] Get:32 http://mirrors.wikimedia.org/debian bookworm/main amd64 libbrotli1 amd64 1.0.9-2+b6 [275 kB] Get:33 http://mirrors.wikimedia.org/debian bookworm/main amd64 libsasl2-modules-db amd64 2.1.28+dfsg-10 [20.3 kB] Get:34 http://mirrors.wikimedia.org/debian bookworm/main amd64 libsasl2-2 amd64 2.1.28+dfsg-10 [59.7 kB] Get:35 http://mirrors.wikimedia.org/debian bookworm/main amd64 libldap-2.5-0 amd64 2.5.13+dfsg-5 [183 kB] Get:36 http://mirrors.wikimedia.org/debian bookworm/main amd64 libnghttp2-14 amd64 1.52.0-1+deb12u1 [72.4 kB] Get:37 http://mirrors.wikimedia.org/debian bookworm/main amd64 librtmp1 amd64 2.4+20151223.gitfa8646d.1-2+b2 [60.8 kB] Get:38 http://mirrors.wikimedia.org/debian bookworm/main amd64 libssh2-1 amd64 1.10.0-3+b1 [179 kB] Get:39 http://mirrors.wikimedia.org/debian bookworm/main amd64 libcurl3-gnutls amd64 7.88.1-10+deb12u5 [385 kB] Get:40 http://mirrors.wikimedia.org/debian bookworm/main amd64 liberror-perl all 0.17029-2 [29.0 kB] Get:41 http://mirrors.wikimedia.org/debian bookworm/main amd64 git-man all 1:2.39.2-1.1 [2049 kB] Get:42 http://mirrors.wikimedia.org/debian bookworm/main amd64 git amd64 1:2.39.2-1.1 [7171 kB] Get:43 http://mirrors.wikimedia.org/debian bookworm/main amd64 make amd64 4.3-4.1 [396 kB] Get:44 http://mirrors.wikimedia.org/debian bookworm/main amd64 python3-lib2to3 all 3.11.2-3 [76.3 kB] Get:45 http://mirrors.wikimedia.org/debian bookworm/main amd64 python3-distutils all 3.11.2-3 [131 kB] Get:46 http://mirrors.wikimedia.org/debian bookworm/main amd64 python3-pip-whl all 23.0.1+dfsg-1 [1717 kB] Get:47 http://mirrors.wikimedia.org/debian bookworm/main amd64 python3-setuptools-whl all 66.1.1-1 [1111 kB] Get:48 http://mirrors.wikimedia.org/debian bookworm/main amd64 python3.11-venv amd64 3.11.2-6 [5892 B] Get:49 http://mirrors.wikimedia.org/debian bookworm/main amd64 python3-venv amd64 3.11.2-1+b1 [1200 B] Fetched 33.3 MB in 0s (123 MB/s) debconf: delaying package configuration, since apt-utils is not installed Selecting previously unselected package perl-modules-5.36. (Reading database ... 6090 files and directories currently installed.) Preparing to unpack .../0-perl-modules-5.36_5.36.0-7+deb12u1_all.deb ... Unpacking perl-modules-5.36 (5.36.0-7+deb12u1) ... Selecting previously unselected package libgdbm6:amd64. Preparing to unpack .../1-libgdbm6_1.23-3_amd64.deb ... Unpacking libgdbm6:amd64 (1.23-3) ... Selecting previously unselected package libgdbm-compat4:amd64. Preparing to unpack .../2-libgdbm-compat4_1.23-3_amd64.deb ... Unpacking libgdbm-compat4:amd64 (1.23-3) ... Selecting previously unselected package libperl5.36:amd64. Preparing to unpack .../3-libperl5.36_5.36.0-7+deb12u1_amd64.deb ... Unpacking libperl5.36:amd64 (5.36.0-7+deb12u1) ... Selecting previously unselected package perl. Preparing to unpack .../4-perl_5.36.0-7+deb12u1_amd64.deb ... Unpacking perl (5.36.0-7+deb12u1) ... Selecting previously unselected package libssl3:amd64. Preparing to unpack .../5-libssl3_3.0.11-1~deb12u2_amd64.deb ... Unpacking libssl3:amd64 (3.0.11-1~deb12u2) ... Selecting previously unselected package libpython3.11-minimal:amd64. Preparing to unpack .../6-libpython3.11-minimal_3.11.2-6_amd64.deb ... Unpacking libpython3.11-minimal:amd64 (3.11.2-6) ... Selecting previously unselected package libexpat1:amd64. Preparing to unpack .../7-libexpat1_2.5.0-1_amd64.deb ... Unpacking libexpat1:amd64 (2.5.0-1) ... Selecting previously unselected package python3.11-minimal. Preparing to unpack .../8-python3.11-minimal_3.11.2-6_amd64.deb ... Unpacking python3.11-minimal (3.11.2-6) ... Setting up libssl3:amd64 (3.0.11-1~deb12u2) ... Setting up libpython3.11-minimal:amd64 (3.11.2-6) ... Setting up libexpat1:amd64 (2.5.0-1) ... Setting up python3.11-minimal (3.11.2-6) ... Selecting previously unselected package python3-minimal. (Reading database ... 8422 files and directories currently installed.) Preparing to unpack .../00-python3-minimal_3.11.2-1+b1_amd64.deb ... Unpacking python3-minimal (3.11.2-1+b1) ... Selecting previously unselected package media-types. Preparing to unpack .../01-media-types_10.0.0_all.deb ... Unpacking media-types (10.0.0) ... Selecting previously unselected package libncursesw6:amd64. Preparing to unpack .../02-libncursesw6_6.4-4_amd64.deb ... Unpacking libncursesw6:amd64 (6.4-4) ... Selecting previously unselected package libkrb5support0:amd64. Preparing to unpack .../03-libkrb5support0_1.20.1-2+deb12u1_amd64.deb ... Unpacking libkrb5support0:amd64 (1.20.1-2+deb12u1) ... Selecting previously unselected package libk5crypto3:amd64. Preparing to unpack .../04-libk5crypto3_1.20.1-2+deb12u1_amd64.deb ... Unpacking libk5crypto3:amd64 (1.20.1-2+deb12u1) ... Selecting previously unselected package libkeyutils1:amd64. Preparing to unpack .../05-libkeyutils1_1.6.3-2_amd64.deb ... Unpacking libkeyutils1:amd64 (1.6.3-2) ... Selecting previously unselected package libkrb5-3:amd64. Preparing to unpack .../06-libkrb5-3_1.20.1-2+deb12u1_amd64.deb ... Unpacking libkrb5-3:amd64 (1.20.1-2+deb12u1) ... Selecting previously unselected package libgssapi-krb5-2:amd64. Preparing to unpack .../07-libgssapi-krb5-2_1.20.1-2+deb12u1_amd64.deb ... Unpacking libgssapi-krb5-2:amd64 (1.20.1-2+deb12u1) ... Selecting previously unselected package libtirpc-common. Preparing to unpack .../08-libtirpc-common_1.3.3+ds-1_all.deb ... Unpacking libtirpc-common (1.3.3+ds-1) ... Selecting previously unselected package libtirpc3:amd64. Preparing to unpack .../09-libtirpc3_1.3.3+ds-1_amd64.deb ... Unpacking libtirpc3:amd64 (1.3.3+ds-1) ... Selecting previously unselected package libnsl2:amd64. Preparing to unpack .../10-libnsl2_1.3.0-2_amd64.deb ... Unpacking libnsl2:amd64 (1.3.0-2) ... Selecting previously unselected package readline-common. Preparing to unpack .../11-readline-common_8.2-1.3_all.deb ... Unpacking readline-common (8.2-1.3) ... Selecting previously unselected package libreadline8:amd64. Preparing to unpack .../12-libreadline8_8.2-1.3_amd64.deb ... Unpacking libreadline8:amd64 (8.2-1.3) ... Selecting previously unselected package libsqlite3-0:amd64. Preparing to unpack .../13-libsqlite3-0_3.40.1-2_amd64.deb ... Unpacking libsqlite3-0:amd64 (3.40.1-2) ... Selecting previously unselected package libpython3.11-stdlib:amd64. Preparing to unpack .../14-libpython3.11-stdlib_3.11.2-6_amd64.deb ... Unpacking libpython3.11-stdlib:amd64 (3.11.2-6) ... Selecting previously unselected package python3.11. Preparing to unpack .../15-python3.11_3.11.2-6_amd64.deb ... Unpacking python3.11 (3.11.2-6) ... Selecting previously unselected package libpython3-stdlib:amd64. Preparing to unpack .../16-libpython3-stdlib_3.11.2-1+b1_amd64.deb ... Unpacking libpython3-stdlib:amd64 (3.11.2-1+b1) ... Setting up python3-minimal (3.11.2-1+b1) ... Selecting previously unselected package python3. (Reading database ... 8930 files and directories currently installed.) Preparing to unpack .../00-python3_3.11.2-1+b1_amd64.deb ... Unpacking python3 (3.11.2-1+b1) ... Selecting previously unselected package openssl. Preparing to unpack .../01-openssl_3.0.11-1~deb12u2_amd64.deb ... Unpacking openssl (3.0.11-1~deb12u2) ... Selecting previously unselected package ca-certificates. Preparing to unpack .../02-ca-certificates_20230311_all.deb ... Unpacking ca-certificates (20230311) ... Selecting previously unselected package libpsl5:amd64. Preparing to unpack .../03-libpsl5_0.21.2-1_amd64.deb ... Unpacking libpsl5:amd64 (0.21.2-1) ... Selecting previously unselected package wget. Preparing to unpack .../04-wget_1.21.3-1+b2_amd64.deb ... Unpacking wget (1.21.3-1+b2) ... Selecting previously unselected package libbrotli1:amd64. Preparing to unpack .../05-libbrotli1_1.0.9-2+b6_amd64.deb ... Unpacking libbrotli1:amd64 (1.0.9-2+b6) ... Selecting previously unselected package libsasl2-modules-db:amd64. Preparing to unpack .../06-libsasl2-modules-db_2.1.28+dfsg-10_amd64.deb ... Unpacking libsasl2-modules-db:amd64 (2.1.28+dfsg-10) ... Selecting previously unselected package libsasl2-2:amd64. Preparing to unpack .../07-libsasl2-2_2.1.28+dfsg-10_amd64.deb ... Unpacking libsasl2-2:amd64 (2.1.28+dfsg-10) ... Selecting previously unselected package libldap-2.5-0:amd64. Preparing to unpack .../08-libldap-2.5-0_2.5.13+dfsg-5_amd64.deb ... Unpacking libldap-2.5-0:amd64 (2.5.13+dfsg-5) ... Selecting previously unselected package libnghttp2-14:amd64. Preparing to unpack .../09-libnghttp2-14_1.52.0-1+deb12u1_amd64.deb ... Unpacking libnghttp2-14:amd64 (1.52.0-1+deb12u1) ... Selecting previously unselected package librtmp1:amd64. Preparing to unpack .../10-librtmp1_2.4+20151223.gitfa8646d.1-2+b2_amd64.deb ... Unpacking librtmp1:amd64 (2.4+20151223.gitfa8646d.1-2+b2) ... Selecting previously unselected package libssh2-1:amd64. Preparing to unpack .../11-libssh2-1_1.10.0-3+b1_amd64.deb ... Unpacking libssh2-1:amd64 (1.10.0-3+b1) ... Selecting previously unselected package libcurl3-gnutls:amd64. Preparing to unpack .../12-libcurl3-gnutls_7.88.1-10+deb12u5_amd64.deb ... Unpacking libcurl3-gnutls:amd64 (7.88.1-10+deb12u5) ... Selecting previously unselected package liberror-perl. Preparing to unpack .../13-liberror-perl_0.17029-2_all.deb ... Unpacking liberror-perl (0.17029-2) ... Selecting previously unselected package git-man. Preparing to unpack .../14-git-man_1%3a2.39.2-1.1_all.deb ... Unpacking git-man (1:2.39.2-1.1) ... Selecting previously unselected package git. Preparing to unpack .../15-git_1%3a2.39.2-1.1_amd64.deb ... Unpacking git (1:2.39.2-1.1) ... Selecting previously unselected package make. Preparing to unpack .../16-make_4.3-4.1_amd64.deb ... Unpacking make (4.3-4.1) ... Selecting previously unselected package python3-lib2to3. Preparing to unpack .../17-python3-lib2to3_3.11.2-3_all.deb ... Unpacking python3-lib2to3 (3.11.2-3) ... Selecting previously unselected package python3-distutils. Preparing to unpack .../18-python3-distutils_3.11.2-3_all.deb ... Unpacking python3-distutils (3.11.2-3) ... Selecting previously unselected package python3-pip-whl. Preparing to unpack .../19-python3-pip-whl_23.0.1+dfsg-1_all.deb ... Unpacking python3-pip-whl (23.0.1+dfsg-1) ... Selecting previously unselected package python3-setuptools-whl. Preparing to unpack .../20-python3-setuptools-whl_66.1.1-1_all.deb ... Unpacking python3-setuptools-whl (66.1.1-1) ... Selecting previously unselected package python3.11-venv. Preparing to unpack .../21-python3.11-venv_3.11.2-6_amd64.deb ... Unpacking python3.11-venv (3.11.2-6) ... Selecting previously unselected package python3-venv. Preparing to unpack .../22-python3-venv_3.11.2-1+b1_amd64.deb ... Unpacking python3-venv (3.11.2-1+b1) ... Setting up media-types (10.0.0) ... Setting up python3-setuptools-whl (66.1.1-1) ... Setting up libkeyutils1:amd64 (1.6.3-2) ... Setting up libpsl5:amd64 (0.21.2-1) ... Setting up wget (1.21.3-1+b2) ... Setting up libtirpc-common (1.3.3+ds-1) ... Setting up libbrotli1:amd64 (1.0.9-2+b6) ... Setting up libsqlite3-0:amd64 (3.40.1-2) ... Setting up libnghttp2-14:amd64 (1.52.0-1+deb12u1) ... Setting up libkrb5support0:amd64 (1.20.1-2+deb12u1) ... Setting up libsasl2-modules-db:amd64 (2.1.28+dfsg-10) ... Setting up perl-modules-5.36 (5.36.0-7+deb12u1) ... Setting up make (4.3-4.1) ... Setting up librtmp1:amd64 (2.4+20151223.gitfa8646d.1-2+b2) ... Setting up libncursesw6:amd64 (6.4-4) ... Setting up libk5crypto3:amd64 (1.20.1-2+deb12u1) ... Setting up libsasl2-2:amd64 (2.1.28+dfsg-10) ... Setting up git-man (1:2.39.2-1.1) ... Setting up libssh2-1:amd64 (1.10.0-3+b1) ... Setting up libkrb5-3:amd64 (1.20.1-2+deb12u1) ... Setting up openssl (3.0.11-1~deb12u2) ... Setting up readline-common (8.2-1.3) ... Setting up libgdbm6:amd64 (1.23-3) ... Setting up libreadline8:amd64 (8.2-1.3) ... Setting up libldap-2.5-0:amd64 (2.5.13+dfsg-5) ... Setting up ca-certificates (20230311) ... debconf: unable to initialize frontend: Dialog debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 78.) debconf: falling back to frontend: Readline Updating certificates in /etc/ssl/certs... 140 added, 0 removed; done. Setting up libgssapi-krb5-2:amd64 (1.20.1-2+deb12u1) ... Setting up libgdbm-compat4:amd64 (1.23-3) ... Setting up libperl5.36:amd64 (5.36.0-7+deb12u1) ... Setting up libtirpc3:amd64 (1.3.3+ds-1) ... Setting up python3-pip-whl (23.0.1+dfsg-1) ... Setting up libcurl3-gnutls:amd64 (7.88.1-10+deb12u5) ... Setting up perl (5.36.0-7+deb12u1) ... Setting up libnsl2:amd64 (1.3.0-2) ... Setting up libpython3.11-stdlib:amd64 (3.11.2-6) ... Setting up liberror-perl (0.17029-2) ... Setting up git (1:2.39.2-1.1) ... Setting up libpython3-stdlib:amd64 (3.11.2-1+b1) ... Setting up python3.11 (3.11.2-6) ... Setting up python3 (3.11.2-1+b1) ... running python rtupdate hooks for python3.11... running python post-rtupdate hooks for python3.11... Setting up python3-lib2to3 (3.11.2-3) ... Setting up python3-distutils (3.11.2-3) ... Setting up python3.11-venv (3.11.2-6) ... Setting up python3-venv (3.11.2-1+b1) ... Processing triggers for libc-bin (2.36-9+deb12u6) ... Processing triggers for ca-certificates (20230311) ... Updating certificates in /etc/ssl/certs... 0 added, 0 removed; done. Running hooks in /etc/ca-certificates/update.d... done. root@e653a650a622:/# root@e653a650a622:/# root@e653a650a622:/# root@e653a650a622:/# root@e653a650a622:/# root@e653a650a622:/# root@e653a650a622:/# git clone "https://gerrit.wikimedia.org/r/machinelearning/liftwing/inference-services" Cloning into 'inference-services'... remote: Counting objects: 28, done remote: Finding sources: 100% (28/28) remote: Getting sizes: 100% (21/21) remote: Compressing objects: 100% (24881/24881) remote: Total 3590 (delta 10), reused 3574 (delta 2) Receiving objects: 100% (3590/3590), 712.09 KiB | 9.01 MiB/s, done. Resolving deltas: 100% (2034/2034), done. root@e653a650a622:/# root@e653a650a622:/# root@e653a650a622:/# root@e653a650a622:/# root@e653a650a622:/# root@e653a650a622:/# git clone "https://gerrit.wikimedia.org/r/machinelearning/liftwing/inference-services" Cloning into 'inference-services'... remote: Counting objects: 28, done remote: Finding sources: 100% (28/28) remote: Getting sizes: 100% (21/21) remote: Compressing objects: 100% (24881/24881) remote: Total 3590 (delta 10), reused 3574 (delta 2) Receiving objects: 100% (3590/3590), 712.09 KiB | 13.96 MiB/s, done. Resolving deltas: 100% (2034/2034), done. root@e653a650a622:/# root@e653a650a622:/# root@e653a650a622:/# root@e653a650a622:/# root@e653a650a622:/# root@e653a650a622:/# cd inference-services && git fetch https://gerrit.wikimedia.org/r/machinelearning/liftwing/inference-services refs/changes/32/1023532/1 && git checkout -b change-1023532 FETCH_HEAD remote: Counting objects: 221, done remote: Finding sources: 100% (4/4) remote: Getting sizes: 100% (1/1) remote: Total 4 (delta 2), reused 4 (delta 2) Unpacking objects: 100% (4/4), 1.08 KiB | 275.00 KiB/s, done. From https://gerrit.wikimedia.org/r/machinelearning/liftwing/inference-services * branch refs/changes/32/1023532/1 -> FETCH_HEAD Switched to a new branch 'change-1023532' root@e653a650a622:/inference-services# root@e653a650a622:/inference-services# root@e653a650a622:/inference-services# root@e653a650a622:/inference-services# root@e653a650a622:/inference-services# root@e653a650a622:/inference-services# git log commit c109cf7454b3167296350be1fff15d3d477ce6aa (HEAD -> change-1023532) Author: kevinbazira <kvnbzr@gmail.com> Date: Wed Apr 24 15:33:05 2024 +0300
Following the conversation we had on IRC, this is the resolution we went with as suggested by @achou :
aiko: I had the same issue where tensorflow-cpu isn't available for apple silicon. I tried to install tensorflow instead and it worked maybe tensorflow-cpu is missing sth necessary for running on mac os. I suggest we could add a comment in the makefile for mac users
Based on the logs, it looks like the build process successfully sets up: a Python venv, installs required dependencies, and downloads the model but fails at the last step where it's supposed to run the model-server.
Thank you for sharing the logs @isarantopoulos, I have not experienced the Illegal instruction issue shown above.
Wed, Apr 24
Hi @Isaac thank you for following up on this. The Content Translation recommendation API is now live in LiftWing production. It can be accessed through:
1.External endpoint:
curl -s "https://api.wikimedia.org/service/lw/recommendation/v1/api?s=en&t=fr&n=3&article=Apple"
2.Internal endpoint:
curl "https://recommendation-api-ng.discovery.wmnet:31443/api?s=en&t=fr&n=3&article=Apple"
Feel free to explore these endpoints, and if you encounter any edge cases, please don't hesitate to let us know. :)
Fri, Apr 19
@mfossati, when a model-server is deployed within the WMF k8s infrastructure it has to be configured to enable it to access external resources like wikimedia, wikipedia, and wikidata (see details here). Is it possible for the Structured content team to provide sample URLs from the commons upload stash? This will enable us to configure the logo-detection model-server to access them from LiftWing. Thanks in advance.
Thank you for your help in troubleshooting and resolving the permissions issue, @klausman and @isarantopoulos!
Thu, Apr 18
I have reviewed the logs and found that the CrashLoopBackOff error is occurring because the model-server lacks the necessary permissions to load the logo-detection model:
$ kubectl describe pod logo-detection-predictor-00001-deployment-7f98bb54f7-hpnf4 . . . Traceback (most recent call last): File "/srv/logo_detection/model_server/model.py", line 210, in <module> model = LogoDetectionModel(model_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/srv/logo_detection/model_server/model.py", line 33, in __init__ self.model = self.load() ^^^^^^^^^^^ File "/srv/logo_detection/model_server/model.py", line 36, in load model = keras.models.load_model(self.model_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/lib/python/site-packages/keras/src/saving/saving_api.py", line 176, in load_model return saving_lib.load_model( ^^^^^^^^^^^^^^^^^^^^^^ File "/opt/lib/python/site-packages/keras/src/saving/saving_lib.py", line 139, in load_model with file_utils.File(filepath, mode="r+b") as gfile_handle, zipfile.ZipFile( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/lib/python/site-packages/keras/src/utils/file_utils.py", line 436, in File return open(path, mode=mode) ^^^^^^^^^^^^^^^^^^^^^ PermissionError: [Errno 13] Permission denied: '/mnt/models/logo_max_all.keras' . . .
I am going to reach out to SREs to assist in resolving this permission issue.
I have deployed the logo-detection model-server in the experimental namespace on LiftWing staging. On checking the pod, I noticed it was not starting successfully due to a CrashLoopBackOff error:
$ kubectl get pods . . . NAME READY STATUS RESTARTS AGE logo-detection-predictor-00001-deployment-7f98bb54f7-hpnf4 1/3 CrashLoopBackOff 5 (36s ago) 4m31s . . .
Wed, Apr 17
The logo-detection model-server has been containerized and added to the the CI pipeline which published it successfully to the Wikimedia docker registry: https://docker-registry.wikimedia.org/wikimedia/machinelearning-liftwing-inference-services-logo-detection/tags/
In T362749, we are going to deploy this model-server to LiftWing staging for user acceptance testing.
Tue, Apr 16
The largest layer size for the logo-detection model-server docker image has been reduced from ~2.37GBs to ~1.61GB as shown below:
$ docker history 504c84534141 IMAGE CREATED CREATED BY SIZE COMMENT 504c84534141 About a minute ago LABEL blubber.variant=production blubber.ver… 0B buildkit.dockerfile.v0 <missing> About a minute ago ENTRYPOINT ["./entrypoint.sh"] 0B buildkit.dockerfile.v0 <missing> About a minute ago COPY common_settings.sh common_settings.sh #… 1.16kB buildkit.dockerfile.v0 <missing> About a minute ago COPY model_server_entrypoint.sh entrypoint.s… 294B buildkit.dockerfile.v0 <missing> About a minute ago COPY /opt/lib/python/site-packages /opt/lib/… 1.61GB buildkit.dockerfile.v0 <missing> 50 minutes ago COPY python python/ # buildkit 23.2kB buildkit.dockerfile.v0 <missing> 50 minutes ago COPY logo_detection/model_server/. model_ser… 9.11kB buildkit.dockerfile.v0 <missing> 3 hours ago ENV PATH=/opt/lib/python/site-packages/bin:/… 0B buildkit.dockerfile.v0 <missing> 3 hours ago ENV PYTHONPATH=/srv/logo_detection 0B buildkit.dockerfile.v0 <missing> 3 hours ago WORKDIR /srv/logo_detection 0B buildkit.dockerfile.v0 <missing> 3 hours ago ENV HOME=/home/somebody 0B buildkit.dockerfile.v0 <missing> 3 hours ago USER 65533 0B buildkit.dockerfile.v0 <missing> 3 hours ago RUN |6 LIVES_AS=somebody LIVES_UID=65533 LIV… 9.33kB buildkit.dockerfile.v0 <missing> 3 hours ago ARG RUNS_GID=900 0B buildkit.dockerfile.v0 <missing> 3 hours ago ARG RUNS_UID=900 0B buildkit.dockerfile.v0 <missing> 3 hours ago ARG RUNS_AS=runuser 0B buildkit.dockerfile.v0 <missing> 3 hours ago RUN |3 LIVES_AS=somebody LIVES_UID=65533 LIV… 9.14kB buildkit.dockerfile.v0 <missing> 3 hours ago ARG LIVES_GID=65533 0B buildkit.dockerfile.v0 <missing> 3 hours ago ARG LIVES_UID=65533 0B buildkit.dockerfile.v0 <missing> 3 hours ago ARG LIVES_AS=somebody 0B buildkit.dockerfile.v0 <missing> 3 hours ago RUN /bin/sh -c apt-get update && apt-get ins… 36.7MB buildkit.dockerfile.v0 <missing> 3 hours ago ENV DEBIAN_FRONTEND=noninteractive 0B buildkit.dockerfile.v0 <missing> 3 hours ago ENV HOME=/root 0B buildkit.dockerfile.v0 <missing> 3 hours ago USER 0 0B buildkit.dockerfile.v0 <missing> 8 days ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0B <missing> 8 days ago /bin/sh -c #(nop) ENV LC_ALL=C.UTF-8 0B <missing> 8 days ago /bin/sh -c #(nop) ADD file:99ecae923f6a2afcc… 80.6MB
Since this model-server will be running on CPU until the GPU procurement is complete, tensorflow has been replaced with tensorflow-cpu which installs smaller files:
$ du -hs /opt/lib/python/site-packages/tensorflow/* | sort -h | tail 580K /opt/lib/python/site-packages/tensorflow/dtensor 612K /opt/lib/python/site-packages/tensorflow/tools 6.2M /opt/lib/python/site-packages/tensorflow/core 6.3M /opt/lib/python/site-packages/tensorflow/_api 21M /opt/lib/python/site-packages/tensorflow/lite 30M /opt/lib/python/site-packages/tensorflow/compiler 48M /opt/lib/python/site-packages/tensorflow/libtensorflow_framework.so.2 100M /opt/lib/python/site-packages/tensorflow/python 174M /opt/lib/python/site-packages/tensorflow/include 556M /opt/lib/python/site-packages/tensorflow/libtensorflow_cc.so.2
The tensorflow python package is the main contributor to the largest layer size indicated above. The installation of this package includes several large files, with the largest being ~965MBs as shown below:
$ du -hs /opt/lib/python/site-packages/tensorflow/* | sort -h | tail 580K /opt/lib/python/site-packages/tensorflow/dtensor 612K /opt/lib/python/site-packages/tensorflow/tools 6.3M /opt/lib/python/site-packages/tensorflow/_api 6.7M /opt/lib/python/site-packages/tensorflow/core 22M /opt/lib/python/site-packages/tensorflow/lite 31M /opt/lib/python/site-packages/tensorflow/compiler 104M /opt/lib/python/site-packages/tensorflow/python 130M /opt/lib/python/site-packages/tensorflow/libtensorflow_framework.so.2 422M /opt/lib/python/site-packages/tensorflow/include 965M /opt/lib/python/site-packages/tensorflow/libtensorflow_cc.so.2
Successfully built the logo-detection model-server docker image locally. Below are the image layers with the largest layer size being ~2.37GB.
$ docker history c7907df16443 IMAGE CREATED CREATED BY SIZE COMMENT c7907df16443 48 seconds ago LABEL blubber.variant=production blubber.ver… 0B buildkit.dockerfile.v0 <missing> 48 seconds ago ENTRYPOINT ["./entrypoint.sh"] 0B buildkit.dockerfile.v0 <missing> 48 seconds ago COPY common_settings.sh common_settings.sh #… 1.16kB buildkit.dockerfile.v0 <missing> 48 seconds ago COPY model_server_entrypoint.sh entrypoint.s… 294B buildkit.dockerfile.v0 <missing> 48 seconds ago COPY /opt/lib/python/site-packages /opt/lib/… 2.37GB buildkit.dockerfile.v0 <missing> 51 seconds ago COPY python python/ # buildkit 23.2kB buildkit.dockerfile.v0 <missing> 20 minutes ago COPY logo_detection/model_server/. model_ser… 9.1kB buildkit.dockerfile.v0 <missing> 20 minutes ago ENV PATH=/opt/lib/python/site-packages/bin:/… 0B buildkit.dockerfile.v0 <missing> 20 minutes ago ENV PYTHONPATH=/srv/logo_detection 0B buildkit.dockerfile.v0 <missing> 20 minutes ago WORKDIR /srv/logo_detection 0B buildkit.dockerfile.v0 <missing> 20 minutes ago ENV HOME=/home/somebody 0B buildkit.dockerfile.v0 <missing> 20 minutes ago USER 65533 0B buildkit.dockerfile.v0 <missing> 20 minutes ago RUN |6 LIVES_AS=somebody LIVES_UID=65533 LIV… 9.33kB buildkit.dockerfile.v0 <missing> 20 minutes ago ARG RUNS_GID=900 0B buildkit.dockerfile.v0 <missing> 20 minutes ago ARG RUNS_UID=900 0B buildkit.dockerfile.v0 <missing> 20 minutes ago ARG RUNS_AS=runuser 0B buildkit.dockerfile.v0 <missing> 20 minutes ago RUN |3 LIVES_AS=somebody LIVES_UID=65533 LIV… 9.14kB buildkit.dockerfile.v0 <missing> 20 minutes ago ARG LIVES_GID=65533 0B buildkit.dockerfile.v0 <missing> 20 minutes ago ARG LIVES_UID=65533 0B buildkit.dockerfile.v0 <missing> 20 minutes ago ARG LIVES_AS=somebody 0B buildkit.dockerfile.v0 <missing> 20 minutes ago RUN /bin/sh -c apt-get update && apt-get ins… 36.7MB buildkit.dockerfile.v0 <missing> 20 minutes ago ENV DEBIAN_FRONTEND=noninteractive 0B buildkit.dockerfile.v0 <missing> 20 minutes ago ENV HOME=/root 0B buildkit.dockerfile.v0 <missing> 20 minutes ago USER 0 0B buildkit.dockerfile.v0 <missing> 8 days ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0B <missing> 8 days ago /bin/sh -c #(nop) ENV LC_ALL=C.UTF-8 0B <missing> 8 days ago /bin/sh -c #(nop) ADD file:99ecae923f6a2afcc… 80.6MB
We have previously faced issues while pushing images with layer sizes > 2GBs to the docker registry. I going to investigate which package is installing the largest files and see if there is a lighter alternative available.
A custom KServe model-server was created for the logo-detection isvc and can be run locally using instructions in this documentation. To keep consistent with other model-servers, the batch input and output are different from what we had in the prototype phase as shown below:
I/O | Prototype | KServe model-server |
input | [{img1},{img2},{img3}] | {"instances":[{img1},{img2},{img3}]} |
output | {[{img1},{img2},{img3}]} | {"predictions":[{img1},{img2},{img3}]} |
In T362598 we are going to containerize this model-server in order to be able to host it on LiftWing.
Apr 9 2024
Apr 4 2024
Great! Thank you for the confirmation and fixing the dataset type hint. We shall use the latest version of the prototype.
Thanks for all the reviews as we built this prototype, @mfossati! Please confirm whether it is currently taking the input format as specified in T358676#9650781, preprocessing with Keras in the correct way, and returning the expected output (T358676#9637065). Once we receive your confirmation, the ML team will proceed to integrate it into KServe and create a model server that will be hosted on LiftWing.
Apr 3 2024
Thanks for the review. I have pushed an MR that creates a LogoDetectionModel class with its respective methods and type hinting: https://gitlab.wikimedia.org/mfossati/scriptz/-/merge_requests/9
This will enable us easily integrate the prototype into KServe. Please have a look whenever you have a minute. Thanks!
Mar 29 2024
Thanks for the review. I have pushed an MR to handle image download errors: https://gitlab.wikimedia.org/mfossati/scriptz/-/merge_requests/8
Please have a look whenever you have a minute. Thanks!
Mar 28 2024
Thank you for the confirmation. I have pushed an MR for input validation and image limits: https://gitlab.wikimedia.org/mfossati/scriptz/-/merge_requests/7
Please have a look whenever you have a minute. Thanks!
Mar 27 2024
Thank you for the clarification, I've run the version that rounds the floats and below are the results. Please confirm whether the prototype is returning the expected output.
[ { "filename": "12_rue_de_Condé_-_detail.jpg", "target": "logo", "prediction": 0.0008, "out_of_domain": 0.9992 }, { "filename": "Abv.png", "target": "logo", "prediction": 0.9999, "out_of_domain": 0.0001 }, { "filename": "BackupVault_Logo_2019.png", "target": "logo", "prediction": 0.9996, "out_of_domain": 0.0004 }, { "filename": "Blooming_bush_(14248894271).jpg", "target": "logo", "prediction": 0.0051, "out_of_domain": 0.9949 }, { "filename": "Cambia_logo.png", "target": "logo", "prediction": 1.0, "out_of_domain": 0.0 }, { "filename": "Elizabeth_Drive_-_border_of_Edensor_Park_and_Bonnyrigg_Heights_in_New_South_Wales_62.jpg", "target": "logo", "prediction": 0.0007, "out_of_domain": 0.9993 } ]
Once we have this confirmation, we can work on input validation and image limits. The goal is to get your requirements correct before we integrate the prototype into KServe and host it on LiftWing.
I am not able to reproduce this issue. I've tried running the prototype in two enviroments:
- GColab with python 3.10.12, keras==3.0.4, keras-cv==0.8.1, and tensorflow==2.15.0.
- local venv with python 3.9.2, keras==3.0.4, keras-cv==0.8.1, and tensorflow==2.16.1.
Could this be caused by an incompatility in the python version shown in the error message: python3.11?
Thank you for versioning the liftwing_prototype and making changes @mfossati! I tested the changes locally and got results that I shared in P58917#237822. Please have a look whenever you get a minute.
Running this change of the prototype returns the response below. We noticed the out_of_domain values for Abv.png and Cambia_logo.png are >1, specifically 8.932123455451801e-05 and 4.754207475343719e-05 respectively. @mfossati is this expected behavior?
[ { "filename": "12_rue_de_Condé_-_detail.jpg", "target": "logo", "prediction": 0.0008389077847823501, "out_of_domain": 0.9991611242294312 }, { "filename": "Abv.png", "target": "logo", "prediction": 0.9999107122421265, "out_of_domain": 8.932123455451801e-05 }, { "filename": "BackupVault_Logo_2019.png", "target": "logo", "prediction": 0.9995936751365662, "out_of_domain": 0.00040629858267493546 }, { "filename": "Blooming_bush_(14248894271).jpg", "target": "logo", "prediction": 0.0051296367309987545, "out_of_domain": 0.9948704242706299 }, { "filename": "Cambia_logo.png", "target": "logo", "prediction": 0.9999524354934692, "out_of_domain": 4.754207475343719e-05 }, { "filename": "Elizabeth_Drive_-_border_of_Edensor_Park_and_Bonnyrigg_Heights_in_New_South_Wales_62.jpg", "target": "logo", "prediction": 0.0006882766610942781, "out_of_domain": 0.9993116855621338 } ]
Mar 26 2024
Thank you for sharing this information, @mfossati. Based on the requirements you've shared so far, we have worked on a first pass of the prototype that takes the input JSON you specified, preprocesses it similar to the way you did in the demo, and returns the output JSON you specified (see P58917#237712). Please test it and let us know whether we've captured the key requirements correctly before we proceed working on input validation and sanitization, image limits, error handling, etc.
Running this prototype returns the response below:
[ { "filename": "12_rue_de_Cond\u00e9_-_detail.jpg", "target": "logo", "prediction": { "logo": 0.0, "out_of_domain": 1.0 } }, { "filename": "Abv.png", "target": "logo", "prediction": { "logo": 1.0, "out_of_domain": 0.0 } }, { "filename": "BackupVault_Logo_2019.png", "target": "logo", "prediction": { "logo": 1.0, "out_of_domain": 0.0 } }, { "filename": "Blooming_bush_(14248894271).jpg", "target": "logo", "prediction": { "logo": 0.009999999776482582, "out_of_domain": 0.9900000095367432 } }, { "filename": "Cambia_logo.png", "target": "logo", "prediction": { "logo": 1.0, "out_of_domain": 0.0 } }, { "filename": "Elizabeth_Drive_-_border_of_Edensor_Park_and_Bonnyrigg_Heights_in_New_South_Wales_62.jpg", "target": "logo", "prediction": { "logo": 0.0, "out_of_domain": 1.0 } } ]
Mar 25 2024
Support for building and running the articletopic-outlink model-server using the Makefile was added and it can be tested using:
# first terminal $ make articletopic-outlink-predictor # second terminal $ make articletopic-outlink-transformer # third terminal $ curl localhost:8080/v1/models/outlink-topic-model:predict -i -X POST -d '{"page_title": "Douglas_Adams", "lang": "en"}' $ MODEL_TYPE=articletopic make clean
Mar 21 2024
The logo detection prototype currently returns predictions in a plotted grid as shown in T358676#9629389. The code above was added to the prototype and it now returns the prediction in JSON format with keys specified in T358676#9637065.
Mar 20 2024
Thank you for providing more context @mfossati. I shared this information with the team, and they have a few more questions to clarify the implementation details for the logo detection API:
Mar 19 2024
@achou I figured out a way to run both the transformer and predictor locally in the same container. All we have to do is change the predictor's port to 8181 so that the transformer can use port 8080 and --predictor_host="localhost:8181". I am working on a patch that has a README file with instructions on how to run the articletopic-outlink model-server locally.
Mar 18 2024
Running into the error below which is caused by a missing events module. This module is used to generate and send a topic prediction event to EventGate. Turns out this module is in python/events.py and the model-server can't locate it because it is not running like a python module.
Traceback (most recent call last): File "/home/inference-services/outlink-topic-model/model-server/model.py", line 6, in <module> import events ModuleNotFoundError: No module named 'events' make[1]: *** [Makefile:97: run-server] Error 1 make[1]: Leaving directory '/home/inference-services' make: *** [Makefile:76: articletopic-outlink] Error 2
Mar 15 2024
Currently, the method that loads a model has a hardcoded model path. When we set the path through an environmental variable, the error below is thrown. To resolve this, we need to refactor the model server so that it can accept the model path through an environment variable, similar to how other model servers operate.
Warning : `load_model` does not return WordVectorModel or SupervisedModel any more, but a `FastText` object which is very similar. Traceback (most recent call last): File "/home/inference-services/outlink-topic-model/model-server/model.py", line 104, in <module> model = OutlinksTopicModel("outlink-topic-model") File "/home/inference-services/outlink-topic-model/model-server/model.py", line 27, in __init__ self.load() File "/home/inference-services/outlink-topic-model/model-server/model.py", line 45, in load self.model = fasttext.load_model("/mnt/models/model.bin") File "/home/inference-services/my_venv/lib/python3.9/site-packages/fasttext/FastText.py", line 441, in load_model return _FastText(model_path=path) File "/home/inference-services/my_venv/lib/python3.9/site-packages/fasttext/FastText.py", line 98, in __init__ self.f.loadModel(model_path) ValueError: /mnt/models/model.bin cannot be opened for loading! make[1]: *** [Makefile:97: run-server] Error 1 make[1]: Leaving directory '/home/inference-services' make: *** [Makefile:76: articletopic-outlink] Error 2
While building the articletopic-outlink model-server locally, the error below is thrown. We encountered a similar error in T357382#9536821 and resolved it by adding the wheel package to the requirements.txt before installing fasttext.
Collecting fasttext==0.9.2 (from -r outlink-topic-model/model-server/requirements.txt (line 30)) Using cached fasttext-0.9.2.tar.gz (68 kB) Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error
Mar 14 2024
Thank you for providing details about the logo detection project, @mfossati! The ML team is excited to explore hosting it on LiftWing.
Mar 13 2024
Mar 11 2024
@MunizaA, we're happy to hear that the information provided was helpful. For more context, the preprocessing time for each payload was recorded after every request made in both KI v5 and v6 environments. This is why the average value for the Preprocess Runtime (s) column was calculated in the last row of the table.