Skip to content

Commit

Permalink
Merge branch 'ctranslate-dockerfile' into ibaldoall
Browse files Browse the repository at this point in the history
  • Loading branch information
ibaldonl committed Jan 19, 2024
2 parents 5b960d1 + 4fa7377 commit e883501
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions ctranslate/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# From the parent directory (main directory of this repo) run:
#
# docker build --build-arg USERID=$(id -u) -t local/ctranslate-bench ctranslate
#
# If not already using and having a $HOME/.cache/huggingface/ then:
#
# mkdir $HOME/.cache/huggingface/
# docker run --rm -it -v$HOME/.cache/huggingface/:/home/user/.cache/huggingface/:Z \
# local/ctranslate-bench huggingface-cli login
# Answer n to: Add token as git credential? (Y/n) n
#
# Needs 15G RAM free:
# docker run --rm -it -v$HOME/.cache/huggingface/:/home/user/.cache/huggingface/:Z \
# -v$(pwd):/home/user/llama-inference:Z local/ctranslate-bench \
# sh -c 'cd /home/user/llama-inference/ctranslate && ct2-transformers-converter \
# --model meta-llama/Llama-2-7b-hf --output_dir llama-2-7b-ct2'
#
# docker run --rm -it -v$HOME/.cache/huggingface/:/home/user/.cache/huggingface/:Z \
# -v$(pwd):/home/user/llama-inference:Z --gpus all local/ctranslate-bench \
# sh -c 'cd /home/user/llama-inference/ctranslate && python3 bench.py'
#
# If using Podman with CDI substitute
# --gpus all
# for
# --device nvidia.com/gpu=all --security-opt=label=disable

# Select an available version from
# https://github.com/OpenNMT/CTranslate2/pkgs/container/ctranslate2:
FROM ghcr.io/opennmt/ctranslate2:latest-ubuntu20.04-cuda11.2

RUN pip install --no-cache-dir torch transformers pandas

# The parent image ENTRYPOINT does more harm than good, so disable it:
ENTRYPOINT []

ARG USERID=1000
RUN adduser --disabled-password --gecos '' -u $USERID user
USER user

0 comments on commit e883501

Please sign in to comment.