Skip to content

Commit

Permalink
Reduce Docker size by removing duplicate torch install (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgaddair authored Dec 20, 2023
1 parent 9ae65b3 commit 3173826
Show file tree
Hide file tree
Showing 5 changed files with 507 additions and 360 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ COPY server/Makefile server/Makefile

RUN cd server && \
make gen-server && \
pip install ".[bnb, accelerate, quantize]" --no-cache-dir
pip install ".[bnb, accelerate, quantize, peft]" --no-cache-dir

# Install router
COPY --from=builder /usr/src/target/release/lorax-router /usr/local/bin/lorax-router
Expand All @@ -234,7 +234,8 @@ RUN chmod +x sync.sh

RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
sudo ./aws/install
sudo ./aws/install && \
rm -rf aws awscliv2.zip

# ENTRYPOINT ["./entrypoint.sh"]
ENTRYPOINT ["lorax-launcher"]
Expand Down
10 changes: 3 additions & 7 deletions server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,10 @@ gen-server:
find lorax_server/pb/ -type f -name "*.py" -print0 -exec sed -i -e 's/^\(import.*pb2\)/from . \1/g' {} \;
touch lorax_server/pb/__init__.py

install-torch:
# Install specific version of torch
pip install torch --extra-index-url https://download.pytorch.org/whl/cu118 --no-cache-dir

install: gen-server install-torch
install: gen-server
pip install pip --upgrade
pip install -r requirements.txt
pip install -e ".[bnb, accelerate]"
pip install -e ".[bnb, accelerate, quantize, peft]"

run-dev:
# SAFETENSORS_FAST_GPU=1 python -m torch.distributed.run --nproc_per_node=1 lorax_server/cli.py serve gpt2
Expand All @@ -32,4 +28,4 @@ run-dev:
# SAFETENSORS_FAST_GPU=1 python -m torch.distributed.run --nproc_per_node=1 lorax_server/cli.py serve flozi00/Mistral-7B-german-assistant-v5-4bit-autogptq --quantize gptq

export-requirements:
poetry export -o requirements.txt -E bnb -E quantize --without-hashes
poetry export -o requirements.txt -E bnb --without-hashes
Loading

0 comments on commit 3173826

Please sign in to comment.