Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v3.0.0] Major Version - PVC updates and sidecars #34

Merged
merged 4 commits into from
Dec 30, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
update to account for tts output
  • Loading branch information
Mike Kao committed Dec 21, 2023
commit 2302e80f888f3aa5e0da9aae52f8c38d940eda8f
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