Spaces:
Sleeping
Sleeping
Commit
•
f5f22bf
0
Parent(s):
Duplicate from giskardai/giskard
Browse filesCo-authored-by: Inoki at Giskard <inoki-giskard@users.noreply.huggingface.co>
- .gitattributes +35 -0
- Dockerfile +43 -0
- README.md +25 -0
- hf.sh +30 -0
- requirements.txt +3 -0
- supervisord.conf +54 -0
.gitattributes
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
Dockerfile
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM docker.io/giskardai/giskard:2.0.5
|
2 |
+
|
3 |
+
USER root
|
4 |
+
RUN usermod -u 1000 giskard
|
5 |
+
RUN chown -R giskard \
|
6 |
+
/var/run/postgresql \
|
7 |
+
/var/lib/nginx \
|
8 |
+
"${GSK_USER_HOME}" \
|
9 |
+
"${GSK_DIST_PATH}"
|
10 |
+
|
11 |
+
# Use HF persistent storage under /data if mounted
|
12 |
+
ENV GISKARD_HF_DATA_DIR=/data/giskard/datadir
|
13 |
+
RUN mkdir -p "${GISKARD_HF_DATA_DIR}" && chown -R giskard "${GISKARD_HF_DATA_DIR}"
|
14 |
+
|
15 |
+
# Create or declare subdirs under GISKARD_HF_DATA_DIR
|
16 |
+
ENV PGDATA=$GISKARD_HF_DATA_DIR/database
|
17 |
+
RUN mkdir -p "${GISKARD_HF_DATA_DIR}/run" && chown -R giskard "${GISKARD_HF_DATA_DIR}/run"
|
18 |
+
|
19 |
+
# Keep the original GSK_HOME for supervisord run files
|
20 |
+
# We can still bring up supervisord in case of the persistent storage not working
|
21 |
+
ENV GSK_RUN=$GSK_HOME
|
22 |
+
RUN mkdir -p "${GSK_RUN}/run" && chown -R giskard "${GSK_RUN}/run"
|
23 |
+
|
24 |
+
USER giskard
|
25 |
+
|
26 |
+
# Only changed the original supervisord.conf to redirect logs to stdout
|
27 |
+
COPY --chown=giskard supervisord.conf $GSK_DIST_PATH
|
28 |
+
|
29 |
+
# Copy requirements for demo Space external worker
|
30 |
+
COPY --chown=giskard requirements.txt /requirements.txt
|
31 |
+
|
32 |
+
# Internal workr doesn't download resource, but takes them directly from projects, so no cache
|
33 |
+
ENV GSK_CACHE_DIR=projects
|
34 |
+
|
35 |
+
# Redirect to HF persistent storage for Python ($GSK_HOME) and Java ($GISKARD_HOME)
|
36 |
+
ENV GSK_HOME=$GISKARD_HF_DATA_DIR \
|
37 |
+
GISKARD_HOME=$GISKARD_HF_DATA_DIR
|
38 |
+
|
39 |
+
EXPOSE 7860
|
40 |
+
|
41 |
+
# Use a script to create dir and change owner in HF persistent storage during runtime
|
42 |
+
COPY --chown=giskard hf.sh "/giskard-bootstrap.sh"
|
43 |
+
ENTRYPOINT ["bash", "/giskard-bootstrap.sh"]
|
README.md
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Giskard Hub
|
3 |
+
emoji: 🐢
|
4 |
+
colorFrom: green
|
5 |
+
colorTo: green
|
6 |
+
sdk: docker
|
7 |
+
app_port: 7860
|
8 |
+
pinned: false
|
9 |
+
duplicated_from: giskardai/giskard
|
10 |
+
---
|
11 |
+
Welcome to Giskard !
|
12 |
+
You can modify this space to suit your needs.
|
13 |
+
|
14 |
+
The goal for you is to upload your model so you can inspect and test it thanks to Giskard.
|
15 |
+
|
16 |
+
In the Dockerfile you can change the PYTHON_VERSION to any python version between 3.7 and 3.10 !
|
17 |
+
The default value is 3.7.13. If you don't have specific need we advise you to stay with this version because the build will be quicker.
|
18 |
+
|
19 |
+
In the requirements.txt file you can add every python package your model needs. Be carefull, the package giskard is mandatory.
|
20 |
+
|
21 |
+
Finally the main code will be in the project.py file. You can choose the name, description of your project.
|
22 |
+
Then you can upload your model and dataset, by following the Giskard documentation https://docs.giskard.ai/start/guides/upload-your-model.
|
23 |
+
|
24 |
+
As an exemple, we already built one model and dataset in the project.py file. Feel free to delete it.
|
25 |
+
If you have any question, you can contact us on linkedin https://www.linkedin.com/in/alexcombessie/
|
hf.sh
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
echo "Initializing datadir..."
|
4 |
+
|
5 |
+
# Create dir if not existed in HF persistent storage
|
6 |
+
if [ ! -d "${GSK_HOME}" ]
|
7 |
+
then
|
8 |
+
# Create HOME
|
9 |
+
mkdir -p "${GSK_HOME}"
|
10 |
+
# Create frontend run dir
|
11 |
+
mkdir -p "${GSK_HOME}/run/nginx"
|
12 |
+
fi
|
13 |
+
|
14 |
+
if [ ! -z "${GISKARD_LICENSE}" ]
|
15 |
+
then
|
16 |
+
# Use new license if env set
|
17 |
+
echo "${GISKARD_LICENSE}" > "${GISKARD_HOME}/license.lic"
|
18 |
+
fi
|
19 |
+
|
20 |
+
echo "Detecting demo Giskard Space..."
|
21 |
+
|
22 |
+
if [ ! -z "${SPACE_ID}" ] && [ "${DEMO_SPACE_ID}" == "${SPACE_ID}" ]
|
23 |
+
then
|
24 |
+
# Generate GISKARD_DEFAULT_API_KEY in demo space instead of set from Secrets
|
25 |
+
export GISKARD_DEFAULT_API_KEY=gsk-$(cat /dev/urandom | tr -dc '[:alpha:]' | fold -w ${1:-28} | head -n 1)
|
26 |
+
fi
|
27 |
+
|
28 |
+
echo "Starting supervisord..."
|
29 |
+
|
30 |
+
exec supervisord -c "${GSK_DIST_PATH}/supervisord.conf"
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
transformers==4.33.2
|
2 |
+
datasets==2.14.5
|
3 |
+
torch==2.0.1
|
supervisord.conf
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[supervisord]
|
2 |
+
directory=%(ENV_GSK_RUN)s/run
|
3 |
+
pidfile=%(ENV_GSK_RUN)s/run/supervisord.pid
|
4 |
+
logfile=%(ENV_GSK_RUN)s/run/supervisord.log
|
5 |
+
nodaemon=true
|
6 |
+
|
7 |
+
[rpcinterface:supervisor]
|
8 |
+
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
9 |
+
|
10 |
+
|
11 |
+
[unix_http_server]
|
12 |
+
file = %(ENV_GSK_RUN)s/run/svd.sock
|
13 |
+
username = giskard
|
14 |
+
password = giskard
|
15 |
+
|
16 |
+
[supervisorctl]
|
17 |
+
serverurl = unix://%(ENV_GSK_RUN)s/run/svd.sock
|
18 |
+
username = giskard
|
19 |
+
password = giskard
|
20 |
+
|
21 |
+
|
22 |
+
[program:backend]
|
23 |
+
stdout_logfile=/dev/fd/1
|
24 |
+
stdout_logfile_maxbytes=0
|
25 |
+
autorestart=true
|
26 |
+
redirect_stderr=true
|
27 |
+
startsecs=5
|
28 |
+
command=bash -c 'sleep 3 && java -jar %(ENV_GSK_DIST_PATH)s/backend/giskard.jar'
|
29 |
+
|
30 |
+
[program:db]
|
31 |
+
stdout_logfile=/dev/fd/1
|
32 |
+
stdout_logfile_maxbytes=0
|
33 |
+
autorestart=true
|
34 |
+
redirect_stderr=true
|
35 |
+
stopsignal=INT
|
36 |
+
startsecs=5
|
37 |
+
command=/bin/bash %(ENV_GSK_DIST_PATH)s/start-db.sh
|
38 |
+
|
39 |
+
[program:worker]
|
40 |
+
stdout_logfile=/dev/fd/1
|
41 |
+
stdout_logfile_maxbytes=0
|
42 |
+
autorestart=true
|
43 |
+
redirect_stderr=true
|
44 |
+
startsecs=5
|
45 |
+
command=bash -c 'python -m giskard.cli worker stop -s && python -m giskard.cli worker start -s --parallelism 2'
|
46 |
+
|
47 |
+
[program:frontend]
|
48 |
+
stdout_logfile=/dev/fd/1
|
49 |
+
stdout_logfile_maxbytes=0
|
50 |
+
autorestart=true
|
51 |
+
redirect_stderr=true
|
52 |
+
startsecs=5
|
53 |
+
priority=0
|
54 |
+
command=/bin/bash %(ENV_GSK_DIST_PATH)s/start-frontend.sh
|