-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support to pull NIM profiles from GCS cache
- Loading branch information
1 parent
4c8cc24
commit 21b70b5
Showing
12 changed files
with
158 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
cloud-service-providers/google-cloud/gke/infra/3-config/artifacts/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM debian:bookworm-slim | ||
RUN apt-get update && apt-get install -y aria2 pigz | ||
ENTRYPOINT ["/bin/sh"] |
14 changes: 14 additions & 0 deletions
14
cloud-service-providers/google-cloud/gke/infra/3-config/fetch-ngc-url.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/sh | ||
|
||
# use --token-format=full for print-identity-token if using GCE VM. | ||
cat <<EOF > req.cred.json | ||
{ | ||
"bucket": "${NIM_GCS_BUCKET}", | ||
"text": "${NGC_EULA_TEXT}", | ||
"textb64": "$(echo ${NGC_EULA_TEXT} | base64 -w0)", | ||
"jwt": "$(gcloud auth print-identity-token)" | ||
} | ||
EOF | ||
|
||
HTTP_URL="$(curl -s -X POST -H 'accept: application/json' -H 'Content-Type: application/json' -d @req.cred.json "https://${SERVICE_FQDN}/v1/request/${GCS_FILENAME}" | sed 's/.*\(https.*\)\\\\n.*/\1/g')" | ||
echo -n "$HTTP_URL" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
cloud-service-providers/google-cloud/gke/infra/3-config/helm/ngc-cache/files/ngc_pull.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
export CACHE_PATH="$NIM_CACHE_PATH" | ||
|
||
if [ -n "${NGC_BUNDLE_URL:-}" ]; then | ||
# Create a sub-directory, as tar tries to modify the parent folder permissions | ||
export CACHE_PATH="$NIM_CACHE_PATH/cache" | ||
mkdir "$CACHE_PATH" | ||
MODEL_BUNDLE_FILENAME="model.tar" | ||
# Fetch and extract from the provided URL, with max concurrency | ||
aria2c -x 16 -s 16 -j 10 --dir "$CACHE_PATH" --out="$MODEL_BUNDLE_FILENAME" "$NGC_BUNDLE_URL" | ||
tar xf "$CACHE_PATH/$MODEL_BUNDLE_FILENAME" -C "$CACHE_PATH" | ||
rm "$CACHE_PATH/$MODEL_BUNDLE_FILENAME" | ||
else | ||
# Fetch directly from NGC to $NIM_CACHE_PATH | ||
download-to-cache | ||
fi | ||
|
||
find $CACHE_PATH -type d -printf '%P\n' | xargs -P 100 -I {} mkdir -p /upload-dir/{} | ||
find $CACHE_PATH -type f,l -printf '%P\n' | xargs -P 100 -I {} cp --no-dereference $CACHE_PATH/{} /upload-dir/{} |
11 changes: 11 additions & 0 deletions
11
...service-providers/google-cloud/gke/infra/3-config/helm/ngc-cache/templates/configmap.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ .Release.Name }}-scripts-configmap | ||
labels: | ||
{{- include "nim-llm.labels" . | nindent 4 }} | ||
data: | ||
ngc_pull.sh: |- | ||
{{ .Files.Get "files/ngc_pull.sh" | indent 4 }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters