Skip to content

Commit

Permalink
Refactor installation into bash script and use uv instead of pip
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleykleynhans committed May 9, 2024
1 parent 931e863 commit c9aaa39
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 30 deletions.
36 changes: 6 additions & 30 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,16 @@ ENV DEBIAN_FRONTEND=noninteractive \
SHELL=/bin/bash \
PATH="/usr/local/cuda/bin:${PATH}"

# Install Torch
# Install oobabooga
ARG INDEX_URL
ARG TORCH_VERSION
WORKDIR /
RUN python3 -m venv --system-site-packages /venv && \
source /venv/bin/activate && \
pip3 install torch==${TORCH_VERSION} --index-url ${INDEX_URL} && \
deactivate

# Clone the git repo of Text Generation Web UI and set version
ARG OOBABOOGA_COMMIT
RUN git clone https://github.com/oobabooga/text-generation-webui && \
cd /text-generation-webui && \
git checkout ${OOBABOOGA_COMMIT}

# Install the dependencies for Text Generation Web UI
# Including all extensions
WORKDIR /text-generation-webui
ENV INDEX_URL=${INDEX_URL}
ENV TORCH_VERSION=${TORCH_VERSION}
ENV OOBABOOGA_COMMIT=${OOBABOOGA_COMMIT}
#COPY oobabooga/requirements* ./
RUN source /venv/bin/activate && \
pip3 install -r requirements.txt && \
bash -c 'for req in extensions/*/requirements.txt ; do pip3 install -r "$req" ; done' && \
# mkdir -p repositories && \
# cd repositories && \
# git clone https://github.com/turboderp/exllamav2 && \
# cd exllamav2 && \
# pip3 install -r requirements.txt && \
# pip3 install . && \
deactivate

# Fix safetensors module broken by above exllama repository installation
RUN source /venv/bin/activate && \
pip3 install -U safetensors>=0.4.1 && \
deactivate
COPY --chmod=755 build/install.sh /install.sh
RUN /install.sh && rm /install.sh

# NGINX Proxy
COPY nginx/nginx.conf /etc/nginx/nginx.conf
Expand Down
28 changes: 28 additions & 0 deletions build/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
# Install uv
RUN curl -LsSf https://astral.sh/uv/install.sh | sh

# Install torch
source ~/.bashrc
uv venv -p 3.10 /venv
source /venv/bin/activate
uv pip install torch==${TORCH_VERSION} --index-url ${INDEX_URL}

# Clone the git repo of Text Generation Web UI and set version
git clone https://github.com/oobabooga/text-generation-webui
cd /text-generation-webui
git checkout ${OOBABOOGA_COMMIT}

# Install the dependencies for Text Generation Web UI
# Including all extensions
uv pip install -r requirements.txt
bash -c 'for req in extensions/*/requirements.txt ; do pip3 install -r "$req" ; done'
# mkdir -p repositories
# cd repositories
# git clone https://github.com/turboderp/exllamav2
# cd exllamav2
# pip3 install -r requirements.txt
# pip3 install .

# Fix safetensors module broken by above exllama repository installation
uv pip install -U safetensors>=0.4.1

0 comments on commit c9aaa39

Please sign in to comment.