Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

remove some models to save memory during build #53

Merged
merged 6 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
id: metadata
with:
images: |
us-docker.pkg.dev/${{ env.GarProjectID }}/${{ env.GarRepo }}/${{ env.GarImageName }}:${{ github.ref_name }}
us-docker.pkg.dev/${{ env.GarProjectID }}/${{ env.GarRepo }}/${{ env.GarImageName }}:${{ github.sha }}

- name: Model Server Image Docker Build and Push
uses: int128/kaniko-action@v1
Expand All @@ -60,7 +60,7 @@ jobs:
--snapshot-mode=redo
--cache-ttl=730h
tags: |
us-docker.pkg.dev/${{ env.GarProjectID }}/${{ env.GarRepo }}/${{ env.GarImageName }}:${{ github.ref_name }}
us-docker.pkg.dev/${{ env.GarProjectID }}/${{ env.GarRepo }}/${{ env.GarImageName }}:${{ github.sha }}
us-docker.pkg.dev/${{ env.GarProjectID }}/${{ env.GarRepo }}/${{ env.GarImageName }}:latest
build-args: |
DANSWER_VERSION=${{ github.ref_name }}
DANSWER_VERSION=${{ github.sha }}
17 changes: 7 additions & 10 deletions backend/Dockerfile.model_server
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,16 @@ RUN apt-get remove -y --allow-remove-essential perl-base && \
# Download tokenizers, distilbert for the Danswer model
# Download model weights
# Run Nomic to pull in the custom architecture and have it cached locally
RUN python -c "from transformers import AutoTokenizer; \
AutoTokenizer.from_pretrained('distilbert-base-uncased'); \
AutoTokenizer.from_pretrained('mixedbread-ai/mxbai-rerank-xsmall-v1'); \
from huggingface_hub import snapshot_download; \
snapshot_download(repo_id='danswer/hybrid-intent-token-classifier', revision='v1.0.3'); \
snapshot_download('nomic-ai/nomic-embed-text-v1'); \
snapshot_download('mixedbread-ai/mxbai-rerank-xsmall-v1'); \
from sentence_transformers import SentenceTransformer; \
SentenceTransformer(model_name_or_path='nomic-ai/nomic-embed-text-v1', trust_remote_code=True);"
# RUN python -c "from transformers import AutoTokenizer; \
# from huggingface_hub import snapshot_download; \
# snapshot_download(repo_id='danswer/hybrid-intent-token-classifier', revision='v1.0.3'); \
# snapshot_download('nomic-ai/nomic-embed-text-v1'); \
# from sentence_transformers import SentenceTransformer; \
# SentenceTransformer(model_name_or_path='nomic-ai/nomic-embed-text-v1', trust_remote_code=True);"

# In case the user has volumes mounted to /root/.cache/huggingface that they've downloaded while
# running Danswer, don't overwrite it with the built in cache folder
RUN mv /root/.cache/huggingface /root/.cache/temp_huggingface
# RUN mv /root/.cache/huggingface /root/.cache/temp_huggingface

WORKDIR /app

Expand Down
Loading