Skip to content

Commit

Permalink
update to account for tts output
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Kao committed Dec 21, 2023
1 parent fe832e5 commit 2302e80
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 24 deletions.
52 changes: 33 additions & 19 deletions charts/local-ai/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,36 +81,50 @@ spec:
MODEL_DIR={{ .Values.deployment.modelsPath }}
FORCE_DOWNLOAD={{ .Values.models.forceDownload }}
URLS="{{ $urls }}"
LOCK_DIR=/tmp/model-download-locks
mkdir -p "$MODEL_DIR"
mkdir -p "$LOCK_DIR"
mkdir -p "/tmp/generated/images"
mkdir -p "/tmp/generated/audio"
echo "$URLS" | awk -F, '{for (i=1; i<=NF; i++) print $i}' | while read -r line; do
url=$(echo "$line" | awk '{print $1}')
auth=$(echo "$line" | awk '{print $2}')
full_filename=$(basename "$url" .bin)
short_filename=$(echo "$full_filename" | cut -c1-20)
hash=$(echo "$full_filename" | sha256sum | cut -c1-12)
filename="${short_filename}_${hash}"
lockfile="$LOCK_DIR/$filename.lock"
if [ -n "$url" ]; then
filename=$(basename "$url" .bin)
if [ "$FORCE_DOWNLOAD" = false ] && [ -f "$MODEL_DIR/$filename" ]; then
echo "File $filename already exists. Skipping download."
continue
fi
if [ -e "$MODEL_DIR/$filename" ]; then
echo "File $filename already exists. Skipping download."
continue
fi
rm -f "$MODEL_DIR/$filename"
if [ -e "$lockfile" ]; then
echo "Another pod is downloading $filename. Waiting for download to complete."
while [ -e "$lockfile" ]; do sleep 1; done
continue
fi
echo "Downloading $filename"
touch "$lockfile"
if [ -n "$auth" ]; then
wget --header "Authorization: Basic $auth" "$url" -O "$MODEL_DIR/$filename"
else
wget "$url" -O "$MODEL_DIR/$filename"
fi
echo "Downloading $filename"
if [ -n "$auth" ]; then
wget --header "Authorization: Basic $auth" "$url" -O "$MODEL_DIR/$filename"
else
wget "$url" -O "$MODEL_DIR/$filename"
fi
if [ "$?" -ne 0 ]; then
echo "Download failed."
else
echo "Download completed."
fi
if [ "$?" -ne 0 ]; then
echo "Download failed."
rm -f "$lockfile"
exit 1
else
echo "Download completed."
rm -f "$lockfile"
fi
done
volumeMounts:
Expand Down
10 changes: 5 additions & 5 deletions charts/local-ai/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,17 @@ persistence:
models:
enabled: true
annotations: {}
storageClass: longhorn
storageClass: hostPath
accessModes: ReadWriteMany
size: 100Gi
size: 10Gi
globalMount: /models
images:
output:
enabled: true
annotations: {}
storageClass: longhorn
storageClass: hostPAth
accessModes: ReadWriteMany
size: 5Gi
globalMount: /tmp/generated/images
globalMount: /tmp/generated

service:
type: ClusterIP
Expand Down

0 comments on commit 2302e80

Please sign in to comment.