-
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 952eafc
Showing
12 changed files
with
151 additions
and
22 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
20 changes: 20 additions & 0 deletions
20
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,20 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
if [ -n "$NGC_BUNDLE_URL" ]; then | ||
# Fetch and extract from the provided URL, with max concurrency | ||
mkdir "$NIM_CACHE_PATH/cache" | ||
MODEL_BUNDLE_FILENAME="model.tar" | ||
aria2c -x 16 -s 16 -j 10 --dir "$NIM_CACHE_PATH/cache" --out="$MODEL_BUNDLE_FILENAME" "$NGC_BUNDLE_URL" | ||
#pigz -dc "$NIM_CACHE_PATH/cache/$MODEL_BUNDLE_FILENAME" | tar xf "$NIM_CACHE_PATH/cache/$MODEL_BUNDLE_FILENAME" -C "$NIM_CACHE_PATH/cache" | ||
tar xf "$NIM_CACHE_PATH/cache/$MODEL_BUNDLE_FILENAME" -C "$NIM_CACHE_PATH/cache" | ||
#tar -xzf "$NIM_CACHE_PATH/cache/model.tar.gz" -C "$NIM_CACHE_PATH/cache" | ||
rm "$NIM_CACHE_PATH/cache/$MODEL_BUNDLE_FILENAME" | ||
else | ||
# Fetch directly from NGC to $NIM_CACHE_PATH | ||
download-to-cache | ||
fi | ||
|
||
find $NIM_CACHE_PATH/cache -type d -printf '%P\n' | xargs -P 100 -I {} mkdir -p /upload-dir/{} | ||
find $NIM_CACHE_PATH/cache -type f,l -printf '%P\n' | xargs -P 100 -I {} cp --no-dereference $NIM_CACHE_PATH/cache/{} /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