From d1807d37ad3c03f5322f96b134e7d0b42d7fe679 Mon Sep 17 00:00:00 2001 From: Raven Scott Date: Sat, 6 May 2023 01:41:03 +0200 Subject: [PATCH] HuggingFace Deploy Instructions --- huggingface-config/Dockerfile | 38 +++++++++++++++++++++++++++ huggingface-config/README.md | 13 +++++++++ huggingface-config/start.sh | 0 huggingface-config/startServices.json | 14 ++++++++++ 4 files changed, 65 insertions(+) create mode 100644 huggingface-config/Dockerfile create mode 100644 huggingface-config/README.md create mode 100644 huggingface-config/start.sh create mode 100644 huggingface-config/startServices.json diff --git a/huggingface-config/Dockerfile b/huggingface-config/Dockerfile new file mode 100644 index 0000000..118e991 --- /dev/null +++ b/huggingface-config/Dockerfile @@ -0,0 +1,38 @@ +FROM ubuntu:latest + +RUN apt update + +RUN DEBIAN_FRONTEND=noninteractive apt install curl sudo -y + +RUN curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - + +RUN DEBIAN_FRONTEND=noninteractive apt install nodejs -y + +RUN npm i pm2 -g + +RUN mkdir -p /code/.pm2 + +RUN mkdir -p /.pm2 + +RUN chmod 0777 /code/.pm2 + +RUN chmod 0777 /.pm2 + +RUN DEBIAN_FRONTEND=noninteractive apt install wget python3 python3-pip -y + +WORKDIR /code + +RUN pip install --no-cache-dir llama-cpp-python[server] + +COPY . . + +RUN npm i + +ENV HOST localhost +ENV PORT 7860 +ENV MODEL=/code/ggml-vic7b-q4_0.bin +ENV CACHE=1 +ENV PM2_HOME=/code/.pm2 +RUN wget https://huggingface.co/eachadea/ggml-vicuna-7b-1.1/resolve/main/ggml-vic7b-q4_0.bin + +CMD /bin/bash /code/start.sh diff --git a/huggingface-config/README.md b/huggingface-config/README.md new file mode 100644 index 0000000..2fa9f03 --- /dev/null +++ b/huggingface-config/README.md @@ -0,0 +1,13 @@ +# How to Deploy on Hugging Face + +1) Put all of the bots files within your HuggingFace Git Repo. + +2) Move the files Dockerfile - start.sh - startServices.json. (Overwrite the docker file found in the root of the project) + +3) Edit Docker file as you need, the dockerfile is set to automatically download Vicuna 1.1 7B + +4) Push the changes + +You should then see the bot being built and deployed on HuggingFace + +pm2 log will run automatically so you can see frontend and backend logs. \ No newline at end of file diff --git a/huggingface-config/start.sh b/huggingface-config/start.sh new file mode 100644 index 0000000..e69de29 diff --git a/huggingface-config/startServices.json b/huggingface-config/startServices.json new file mode 100644 index 0000000..052ce35 --- /dev/null +++ b/huggingface-config/startServices.json @@ -0,0 +1,14 @@ +{ + "apps": [ + { + "name": "AI-API", + "script": "node /code/llama.js", + "args" : "" + }, + { + "name": "DiscordBot", + "script": "python3 -m llama_cpp.server", + "args" : "" + } + ] +} \ No newline at end of file