Spaces:
Sleeping
Sleeping
WilliamGazeley
commited on
Commit
Β·
bc2413e
1
Parent(s):
7067b68
Initial dockerisation
Browse files- Dockerfile +56 -0
- README.md +2 -7
- packages.txt +2 -0
- requirements.txt +1 -0
- app.py β src/app.py +0 -3
- config.py β src/config.py +0 -0
- functioncall.py β src/functioncall.py +0 -0
- functions.py β src/functions.py +0 -0
- {prompt_assets β src/prompt_assets}/few_shot.json +0 -0
- {prompt_assets β src/prompt_assets}/output_sys_prompt.yml +0 -0
- {prompt_assets β src/prompt_assets}/sys_prompt.yml +0 -0
- prompter.py β src/prompter.py +0 -0
- schema.py β src/schema.py +0 -0
- utils.py β src/utils.py +0 -0
- validator.py β src/validator.py +0 -0
Dockerfile
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM nvidia/cuda:11.7.1-cudnn8-devel-ubuntu22.04
|
2 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
3 |
+
RUN apt-get update && \
|
4 |
+
apt-get upgrade -y && \
|
5 |
+
apt-get install -y --no-install-recommends \
|
6 |
+
git \
|
7 |
+
git-lfs \
|
8 |
+
wget \
|
9 |
+
curl \
|
10 |
+
# python build dependencies \
|
11 |
+
build-essential \
|
12 |
+
libssl-dev \
|
13 |
+
zlib1g-dev \
|
14 |
+
libbz2-dev \
|
15 |
+
libreadline-dev \
|
16 |
+
libsqlite3-dev \
|
17 |
+
libncursesw5-dev \
|
18 |
+
xz-utils \
|
19 |
+
tk-dev \
|
20 |
+
libxml2-dev \
|
21 |
+
libxmlsec1-dev \
|
22 |
+
libffi-dev \
|
23 |
+
liblzma-dev \
|
24 |
+
# gradio dependencies \
|
25 |
+
ffmpeg \
|
26 |
+
&& apt-get clean \
|
27 |
+
&& rm -rf /var/lib/apt/lists/*
|
28 |
+
|
29 |
+
|
30 |
+
RUN useradd -m -u 1000 user
|
31 |
+
USER user
|
32 |
+
ENV HOME=/home/user \
|
33 |
+
PATH=/home/user/.local/bin:${PATH}
|
34 |
+
WORKDIR ${HOME}/app
|
35 |
+
|
36 |
+
RUN curl https://pyenv.run | bash
|
37 |
+
ENV PATH=${HOME}/.pyenv/shims:${HOME}/.pyenv/bin:${PATH}
|
38 |
+
ARG PYTHON_VERSION=3.10.12
|
39 |
+
RUN pyenv install ${PYTHON_VERSION} && \
|
40 |
+
pyenv global ${PYTHON_VERSION} && \
|
41 |
+
pyenv rehash && \
|
42 |
+
pip install --no-cache-dir -U pip setuptools wheel && \
|
43 |
+
pip install packaging ninja
|
44 |
+
|
45 |
+
COPY --chown=1000 ./requirements.txt /tmp/requirements.txt
|
46 |
+
RUN pip install --no-cache-dir --upgrade -r /tmp/requirements.txt && \
|
47 |
+
pip install flash-attn --no-build-isolation
|
48 |
+
|
49 |
+
COPY --chown=1000 src ${HOME}/app
|
50 |
+
|
51 |
+
EXPOSE 7860
|
52 |
+
CMD streamlit run app.py \
|
53 |
+
--server.headless true \
|
54 |
+
--server.enableCORS false \
|
55 |
+
--server.enableXsrfProtection false \
|
56 |
+
--server.fileWatcherType none
|
README.md
CHANGED
@@ -3,11 +3,6 @@ title: LLM ADE Dev
|
|
3 |
emoji: π₯
|
4 |
colorFrom: pink
|
5 |
colorTo: red
|
6 |
-
sdk:
|
7 |
-
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
-
license: apache-2.0
|
11 |
---
|
12 |
-
|
13 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
3 |
emoji: π₯
|
4 |
colorFrom: pink
|
5 |
colorTo: red
|
6 |
+
sdk: docker
|
7 |
+
port: 7860
|
|
|
|
|
|
|
8 |
---
|
|
|
|
packages.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
python3
|
2 |
+
python3-pip
|
requirements.txt
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
ninja==1.11.1.1
|
2 |
numpy==1.26.4
|
3 |
orjson==3.10.3
|
|
|
1 |
+
streamlit==1.34.0
|
2 |
ninja==1.11.1.1
|
3 |
numpy==1.26.4
|
4 |
orjson==3.10.3
|
app.py β src/app.py
RENAMED
@@ -6,9 +6,6 @@ from utils import get_assistant_message
|
|
6 |
from functioncall import ModelInference
|
7 |
from prompter import PromptManager
|
8 |
|
9 |
-
# HACK
|
10 |
-
import subprocess
|
11 |
-
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
12 |
|
13 |
@st.cache_resource(show_spinner="Loading model..")
|
14 |
def init_llm():
|
|
|
6 |
from functioncall import ModelInference
|
7 |
from prompter import PromptManager
|
8 |
|
|
|
|
|
|
|
9 |
|
10 |
@st.cache_resource(show_spinner="Loading model..")
|
11 |
def init_llm():
|
config.py β src/config.py
RENAMED
File without changes
|
functioncall.py β src/functioncall.py
RENAMED
File without changes
|
functions.py β src/functions.py
RENAMED
File without changes
|
{prompt_assets β src/prompt_assets}/few_shot.json
RENAMED
File without changes
|
{prompt_assets β src/prompt_assets}/output_sys_prompt.yml
RENAMED
File without changes
|
{prompt_assets β src/prompt_assets}/sys_prompt.yml
RENAMED
File without changes
|
prompter.py β src/prompter.py
RENAMED
File without changes
|
schema.py β src/schema.py
RENAMED
File without changes
|
utils.py β src/utils.py
RENAMED
File without changes
|
validator.py β src/validator.py
RENAMED
File without changes
|