Skip to content

Commit

Permalink
Add containers/tgi/gpu/2.4.0/entrypoint.sh
Browse files Browse the repository at this point in the history
Adding `exec` implies that the `text-generation-launcher` command in the
`entrypoint.sh` becomes the process with PID 1, allowing it to receive
signals directly; meaning that it can be gracefully shut down.

Co-authored-by: Raphael Glon <[email protected]>
  • Loading branch information
alvarobartt and oOraph committed Oct 28, 2024
1 parent 631b103 commit e4593f9
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions containers/tgi/gpu/2.4.0/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# Check if MODEL_ID starts with "gcs://"
if [[ $AIP_STORAGE_URI == gs://* ]]; then
echo "AIP_STORAGE_URI set and starts with 'gs://', proceeding to download from GCS."
echo "AIP_STORAGE_URI: $AIP_STORAGE_URI"

# Define the target directory
TARGET_DIR="/tmp/model"
mkdir -p "$TARGET_DIR"

# Use gsutil to copy the content from GCS to the target directory
echo "Running: gcloud storage storage cp $AIP_STORAGE_URI/* $TARGET_DIR --recursive"
gcloud storage cp "$AIP_STORAGE_URI/*" "$TARGET_DIR" --recursive

# Check if gsutil command was successful
if [ $? -eq 0 ]; then
echo "Model downloaded successfully to ${TARGET_DIR}."
# Update MODEL_ID to point to the local directory
echo "Updating MODEL_ID to point to the local directory."
export MODEL_ID="$TARGET_DIR"
else
echo "Failed to download model from GCS."
exit 1
fi
fi

ldconfig 2>/dev/null || echo 'unable to refresh ld cache, not a big deal in most cases'

exec text-generation-launcher $@

0 comments on commit e4593f9

Please sign in to comment.