tomasruiz commited on
Commit
afb2bbe
β€’
1 Parent(s): e18d41a

Convert the space into a Docker space

Browse files
Files changed (5) hide show
  1. Dockerfile-llm-app +10 -7
  2. README.md +3 -4
  3. docker-compose.yml +2 -2
  4. requirements.txt +1 -0
  5. st_app.py +1 -15
Dockerfile-llm-app CHANGED
@@ -1,18 +1,21 @@
1
  FROM pytorch/pytorch:2.4.0-cuda12.4-cudnn9-devel
2
 
3
- WORKDIR /app
4
-
5
  RUN apt-get update
6
  RUN apt-get install -y build-essential
7
  RUN apt-get install -y git
8
 
9
- COPY requirements.txt requirements.txt
 
 
 
 
 
 
10
  RUN pip install -r requirements.txt
11
- RUN CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install "llama-cpp-python<=0.2.79.0"
12
- COPY *.py ./
13
- ADD llmlib ./llmlib
14
  RUN pip install -e llmlib
15
- ADD .streamlit .streamlit
16
 
17
  #CMD [ "python", "--version"]
18
  # CMD ["nvidia-smi"]
 
1
  FROM pytorch/pytorch:2.4.0-cuda12.4-cudnn9-devel
2
 
 
 
3
  RUN apt-get update
4
  RUN apt-get install -y build-essential
5
  RUN apt-get install -y git
6
 
7
+ RUN useradd -m -u 1000 user
8
+ USER user
9
+ ENV HOME=/home/user \
10
+ PATH=/home/user/.local/bin:$PATH
11
+ WORKDIR ${HOME}/app
12
+
13
+ COPY --chown=user requirements.txt requirements.txt
14
  RUN pip install -r requirements.txt
15
+ COPY --chown=user *.py ./
16
+ ADD --chown=user llmlib ./llmlib
 
17
  RUN pip install -e llmlib
18
+ ADD --chown=user .streamlit .streamlit
19
 
20
  #CMD [ "python", "--version"]
21
  # CMD ["nvidia-smi"]
README.md CHANGED
@@ -1,11 +1,10 @@
1
  ---
2
  title: Multimodal Vibe Check
3
- emoji: πŸ‘€
4
  colorFrom: red
5
  colorTo: purple
6
- sdk: streamlit
7
- sdk_version: 1.41.1
8
- app_file: st_app.py
9
  pinned: false
10
  ---
11
 
 
1
  ---
2
  title: Multimodal Vibe Check
3
+ emoji: 😎
4
  colorFrom: red
5
  colorTo: purple
6
+ sdk: docker
7
+ app_port: 8020
 
8
  pinned: false
9
  ---
10
 
docker-compose.yml CHANGED
@@ -3,7 +3,7 @@ x-common-gpu: &common-gpu
3
  dockerfile: Dockerfile-llm-app
4
  environment:
5
  - OPENAI_API_KEY=${OPENAI_API_KEY}
6
- - HF_HOME=/app/.cache/huggingface
7
  - HF_TOKEN=${HF_TOKEN}
8
  - LLMS_REST_API_KEY=${LLMS_REST_API_KEY}
9
  - BUGSNAG_API_KEY=${BUGSNAG_API_KEY}
@@ -15,7 +15,7 @@ x-common-gpu: &common-gpu
15
  count: all
16
  capabilities: [gpu]
17
  volumes:
18
- - /home/tomasruiz/.cache/huggingface:/app/.cache/huggingface
19
 
20
  services:
21
 
 
3
  dockerfile: Dockerfile-llm-app
4
  environment:
5
  - OPENAI_API_KEY=${OPENAI_API_KEY}
6
+ - HF_HOME=/home/user/.cache/huggingface
7
  - HF_TOKEN=${HF_TOKEN}
8
  - LLMS_REST_API_KEY=${LLMS_REST_API_KEY}
9
  - BUGSNAG_API_KEY=${BUGSNAG_API_KEY}
 
15
  count: all
16
  capabilities: [gpu]
17
  volumes:
18
+ - /home/tomasruiz/.cache/huggingface:/home/user/.cache/huggingface
19
 
20
  services:
21
 
requirements.txt CHANGED
@@ -7,3 +7,4 @@ streamlit
7
  bitsandbytes
8
  accelerate
9
  fastapi[standard]
 
 
7
  bitsandbytes
8
  accelerate
9
  fastapi[standard]
10
+ flash_attn
st_app.py CHANGED
@@ -1,20 +1,6 @@
1
  from PIL import Image
2
  import streamlit as st
3
-
4
- try:
5
- from llmlib.runtime import filled_model_registry
6
- except ModuleNotFoundError:
7
- import os
8
- import subprocess
9
-
10
- os.system("pip install -e ./llmlib")
11
- subprocess.run(
12
- "pip install flash-attn --no-build-isolation",
13
- env={"FLASH_ATTENTION_SKIP_CUDA_BUILD": "TRUE"},
14
- shell=True,
15
- )
16
- from llmlib.runtime import filled_model_registry
17
-
18
  from llmlib.model_registry import ModelEntry, ModelRegistry
19
  from llmlib.base_llm import Message
20
  from llmlib.bundler import Bundler
 
1
  from PIL import Image
2
  import streamlit as st
3
+ from llmlib.runtime import filled_model_registry
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  from llmlib.model_registry import ModelEntry, ModelRegistry
5
  from llmlib.base_llm import Message
6
  from llmlib.bundler import Bundler