Skip to content

Commit 0b28cc5

Browse files
author
Harika
committed
updated mount script with retries and added hugging face validation in deploy script
Signed-off-by: Harika <codewith3@gmail.com>
1 parent efcdff4 commit 0b28cc5

3 files changed

Lines changed: 133 additions & 128 deletions

File tree

third_party/Dell/ubuntu-22.04/iac/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ You may also use any internally hosted ISO that is reachable by iDRAC.
6666
chmod +x mount-iso.sh
6767
./mount-iso.sh
6868
```
69+
### To Unmount ISO
70+
use this command, if you want to unmount ISO.
71+
```bash
72+
./mount-iso.sh -u
73+
```
74+
6975
---
7076

7177
## 2. Boot Ubuntu Installer (Terraform + Redfish)

third_party/Dell/ubuntu-22.04/iac/deploy-enterprise-inference.sh

Lines changed: 44 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ GPU_TYPE="Enter gaudi3/cpu based on your deployment"
3838
MODELS=""
3939
DEPLOYMENT_MODE="keycloak"
4040
DEPLOY_OBSERVABILITY="off"
41-
KEYCLOAK_CLIENT_ID="my-client-id"
42-
KEYCLOAK_ADMIN_USER="your-keycloak-admin-user"
43-
KEYCLOAK_ADMIN_PASSWORD="changeme"
41+
KEYCLOAK_CLIENT_ID="api"
42+
KEYCLOAK_ADMIN_USER="api-admin"
43+
KEYCLOAK_ADMIN_PASSWORD="changeme!!"
4444
FIRMWARE_VERSION="1.22.1"
4545
STATE_FILE="/tmp/ei-deploy.state"
4646
BRANCH="release-1.4.0"
@@ -104,17 +104,21 @@ escape_sed_replacement() {
104104
# Hugging Face token checks for selected model numbers
105105
check_hf_token_access() {
106106
log_info "Validating Hugging Face token..."
107+
107108
local response http_code body
108109
response=$(curl -sS -w $'\n%{http_code}' \
109110
-H "Authorization: Bearer ${HF_TOKEN}" \
110-
"https://huggingface.co/api/whoami-v2")
111+
https://huggingface.co/api/whoami-v2)
112+
111113
http_code="${response##*$'\n'}"
112114
body="${response%$'\n'*}"
115+
113116
if [[ "$http_code" != "200" ]]; then
114117
log_error "Hugging Face token validation failed (HTTP ${http_code})"
115118
echo "$body"
116119
exit 1
117120
fi
121+
118122
log_success "Hugging Face token is valid"
119123

120124
if [[ -z "${MODELS:-}" ]]; then
@@ -124,45 +128,60 @@ check_hf_token_access() {
124128

125129
IFS=',' read -r -a model_numbers <<< "${MODELS}"
126130
local model_ids=()
131+
127132
for num in "${model_numbers[@]}"; do
128133
num="$(echo "$num" | xargs)"
129134
if [[ -z "$num" ]]; then
130135
continue
131136
fi
132137
if [[ -z "${MODEL_MAP[$num]:-}" ]]; then
133-
log_warn "Unknown model number '${num}' (no mapping found)"
134-
continue
138+
log_error "Unknown model number '${num}'"
139+
exit 1
135140
fi
136141
model_ids+=("${MODEL_MAP[$num]}")
137142
done
138143

139-
if [[ ${#model_ids[@]} -eq 0 ]]; then
140-
log_warn "No valid model numbers found; skipping model access checks"
141-
return 0
142-
fi
144+
log_info "Checking model access..."
143145

144-
log_info "Checking model access for selected numbers..."
145-
local seen_ids=()
146146
for model_id in "${model_ids[@]}"; do
147-
if [[ " ${seen_ids[*]} " == *" ${model_id} "* ]]; then
148-
continue
149-
fi
150-
seen_ids+=("${model_id}")
151147
log_info "Model: ${model_id}"
152-
local model_code
153-
model_code=$(curl -sS -o /dev/null -w "%{http_code}" \
148+
149+
# Step 1: Check metadata
150+
metadata=$(curl -sS \
154151
-H "Authorization: Bearer ${HF_TOKEN}" \
155152
"https://huggingface.co/api/models/${model_id}")
156-
if [[ "$model_code" == "200" ]]; then
157-
log_success "Access confirmed for ${model_id}"
158-
continue
153+
154+
metadata_code=$(curl -sS -o /dev/null -w "%{http_code}" \
155+
-H "Authorization: Bearer ${HF_TOKEN}" \
156+
"https://huggingface.co/api/models/${model_id}")
157+
158+
if [[ "$metadata_code" != "200" ]]; then
159+
log_error "Model metadata not accessible (HTTP ${metadata_code})"
160+
exit 1
159161
fi
160-
if [[ "$model_code" == "401" || "$model_code" == "403" ]]; then
161-
log_error "Model is gated or token lacks access: ${model_id} (HTTP ${model_code})"
162+
163+
# Detect gated/private
164+
if echo "$metadata" | grep -q '"gated":true'; then
165+
log_error "Model '${model_id}' is gated. Token must have accepted license."
162166
exit 1
163167
fi
164-
log_error "Unable to access model '${model_id}' (HTTP ${model_code})"
165-
exit 1
168+
169+
if echo "$metadata" | grep -q '"private":true'; then
170+
log_error "Model '${model_id}' is private and token lacks permission."
171+
exit 1
172+
fi
173+
174+
# Step 2: Verify real file download access (CRITICAL CHECK)
175+
download_code=$(curl -s -o /dev/null -w "%{http_code}" \
176+
-H "Authorization: Bearer ${HF_TOKEN}" \
177+
"https://huggingface.co/${model_id}/resolve/main/config.json")
178+
179+
if [[ "$download_code" != "200" ]]; then
180+
log_error "Token does NOT have download access for ${model_id} (HTTP ${download_code})"
181+
exit 1
182+
fi
183+
184+
log_success "Access confirmed for ${model_id}"
166185
done
167186
}
168187

0 commit comments

Comments
 (0)