Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ RUN mkdir -p /home/huggingface/.cache/huggingface \
&& mkdir -p /home/huggingface/output

COPY docker-entrypoint.py /usr/local/bin
COPY token.txt /home/huggingface

ENTRYPOINT [ "docker-entrypoint.py" ]
12 changes: 12 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ set_gpu_arg() {
GPU_ARG="--gpus=all"
}

check_token() {
[ -r ${PWD}/token.txt ] || {
echo "ERROR: no token found"
echo "you need to create a user access token in your Huggingface account. Save the user access token in a file called token.txt in current directory."
exit 1
}
}

build() {
docker build . --tag "$CWD"
}
Expand All @@ -24,10 +32,12 @@ clean() {
}

dev() {
check_token
docker run --rm --gpus=all --entrypoint=sh \
-v huggingface:/home/huggingface/.cache/huggingface \
-v "$PWD"/input:/home/huggingface/input \
-v "$PWD"/output:/home/huggingface/output \
-v "$PWD"/token.txt:/home/huggingface/token.txt \
-it "$CWD"
}

Expand All @@ -38,11 +48,13 @@ pull() {
}

run() {
check_token
set_gpu_arg "$@"
docker run --rm ${GPU_ARG} \
-v huggingface:/home/huggingface/.cache/huggingface \
-v "$PWD"/input:/home/huggingface/input \
-v "$PWD"/output:/home/huggingface/output \
-v "$PWD"/token.txt:/home/huggingface/token.txt \
"$CWD" "$@"
}

Expand Down