Skip to content

Commit a8113f4

Browse files
Merge pull request #357 from microsoft/fix/replace-standard-with-globalstandard
fix: replace standard with globalstandard and updated quota check document
2 parents aed17d1 + bf4b778 commit a8113f4

File tree

3 files changed

+83
-22
lines changed

3 files changed

+83
-22
lines changed

docs/quota_check.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
## Check Quota Availability Before Deployment
22

33
Before deploying the accelerator, **ensure sufficient quota availability** for the required model.
4+
> **We recommend increasing the capacity to 100k tokens for optimal performance.**
5+
6+
### Login if you have not done so already
7+
```
8+
azd auth login
9+
```
10+
411

512
### Login if you have not done so already
613
```
@@ -20,27 +27,34 @@ eastus, uksouth, eastus2, northcentralus, swedencentral, westus, westus2, southc
2027
- Only model(s) provided → The script will check for those models in the default regions.
2128
- Only region(s) provided → The script will check default models in the specified regions.
2229
- Both models and regions provided → The script will check those models in the specified regions.
30+
- `--verbose` passed → Enables detailed logging output for debugging and traceability.
2331

2432
### **Input Formats**
25-
✔️ Run without parameters to check default models & regions:
33+
> Use the --models, --regions, and --verbose options for parameter handling:
34+
35+
✔️ Run without parameters to check default models & regions without verbose logging:
2636
```
2737
./quota_check_params.sh
2838
```
29-
✔️ Model name and required capacity in the format:
39+
✔️ Enable verbose logging:
40+
```
41+
./quota_check_params.sh --verbose
42+
```
43+
✔️ Check specific model(s) in default regions:
3044
```
31-
./quota_check_params.sh gpt-4o:30
45+
./quota_check_params.sh --models gpt-4o:30,text-embedding-ada-002:80
3246
```
33-
✔️ Multiple models can be passed, separated by commas:
47+
✔️ Check default models in specific region(s):
3448
```
35-
./quota_check_params.sh gpt-4o:30,text-embedding-ada-002:80
49+
./quota_check_params.sh --regions eastus,westus
3650
```
3751
✔️ Passing Both models and regions:
3852
```
39-
./quota_check_params.sh gpt-4o:30 eastus,westus2
53+
./quota_check_params.sh --models gpt-4o:30 --regions eastus,westus2
4054
```
41-
✔️ Check default models in specific regions:
55+
✔️ All parameters combined:
4256
```
43-
./quota_check_params.sh "" eastus,westus2
57+
./quota_check_params.sh --models gpt-4:30,text-embedding-ada-002:80 --regions eastus,westus --verbose
4458
```
4559

4660
### **Sample Output**
@@ -67,7 +81,7 @@ The final table lists regions with available quota. You can select any of these
6781
### **If using VS Code or Codespaces**
6882
1. Open the terminal in VS Code or Codespaces.
6983
2. If you're using VS Code, click the dropdown on the right side of the terminal window, and select `Git Bash`.
70-
![git_bash](images/git_bash.png)
84+
![git_bash](Images/git_bash.png)
7185
3. Navigate to the `scripts` folder where the script files are located and make the script as executable:
7286
```sh
7387
cd infra/scripts

infra/scripts/checkquota_km.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ echo "✅ Azure subscription set successfully."
3232

3333
# Define models and their minimum required capacities
3434
declare -A MIN_CAPACITY=(
35-
["OpenAI.Standard.gpt-4o-mini"]=$GPT_MIN_CAPACITY #km generic
36-
["OpenAI.Standard.text-embedding-ada-002"]=$TEXT_EMBEDDING_MIN_CAPACITY #km generic
35+
["OpenAI.GlobalStandard.gpt-4o-mini"]=$GPT_MIN_CAPACITY #km generic
36+
["OpenAI.GlobalStandard.text-embedding-ada-002"]=$TEXT_EMBEDDING_MIN_CAPACITY #km generic
3737
)
3838

3939
VALID_REGION=""

infra/scripts/quota_check_params.sh

Lines changed: 58 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,50 @@
11
#!/bin/bash
2+
# VERBOSE=false
3+
4+
MODELS=""
5+
REGIONS=""
6+
VERBOSE=false
7+
8+
while [[ $# -gt 0 ]]; do
9+
case "$1" in
10+
--models)
11+
MODELS="$2"
12+
shift 2
13+
;;
14+
--regions)
15+
REGIONS="$2"
16+
shift 2
17+
;;
18+
--verbose)
19+
VERBOSE=true
20+
shift
21+
;;
22+
*)
23+
echo "Unknown option: $1"
24+
exit 1
25+
;;
26+
esac
27+
done
28+
29+
# Fallback to defaults if not provided
30+
[[ -z "$MODELS" ]]
31+
[[ -z "$REGIONS" ]]
32+
33+
echo "Models: $MODELS"
34+
echo "Regions: $REGIONS"
35+
echo "Verbose: $VERBOSE"
36+
37+
for arg in "$@"; do
38+
if [ "$arg" = "--verbose" ]; then
39+
VERBOSE=true
40+
fi
41+
done
42+
43+
log_verbose() {
44+
if [ "$VERBOSE" = true ]; then
45+
echo "$1"
46+
fi
47+
}
248

349
# Default Models and Capacities (Comma-separated in "model:capacity" format)
450
DEFAULT_MODEL_CAPACITY="gpt-4o:30,gpt-4o-mini:30,gpt-4:30,text-embedding-ada-002:80"
@@ -51,8 +97,8 @@ DEFAULT_REGIONS="eastus,uksouth,eastus2,northcentralus,swedencentral,westus,west
5197
IFS=',' read -r -a DEFAULT_REGION_ARRAY <<< "$DEFAULT_REGIONS"
5298

5399
# Read parameters (if any)
54-
IFS=',' read -r -a USER_PROVIDED_PAIRS <<< "$1"
55-
USER_REGION="$2"
100+
IFS=',' read -r -a USER_PROVIDED_PAIRS <<< "$MODELS"
101+
USER_REGION="$REGIONS"
56102

57103
IS_USER_PROVIDED_PAIRS=false
58104

@@ -100,12 +146,12 @@ INDEX=1
100146

101147
VALID_REGIONS=()
102148
for REGION in "${REGIONS[@]}"; do
103-
echo "----------------------------------------"
104-
echo "🔍 Checking region: $REGION"
149+
log_verbose "----------------------------------------"
150+
log_verbose "🔍 Checking region: $REGION"
105151

106152
QUOTA_INFO=$(az cognitiveservices usage list --location "$REGION" --output json | tr '[:upper:]' '[:lower:]')
107153
if [ -z "$QUOTA_INFO" ]; then
108-
echo "⚠️ WARNING: Failed to retrieve quota for region $REGION. Skipping."
154+
log_verbose "⚠️ WARNING: Failed to retrieve quota for region $REGION. Skipping."
109155
continue
110156
fi
111157

@@ -128,7 +174,7 @@ for REGION in "${REGIONS[@]}"; do
128174
for MODEL_TYPE in "${MODEL_TYPES[@]}"; do
129175
FOUND=false
130176
INSUFFICIENT_QUOTA=false
131-
echo "🔍 Checking model: $MODEL_NAME with required capacity: $REQUIRED_CAPACITY ($MODEL_TYPE)"
177+
log_verbose "🔍 Checking model: $MODEL_NAME with required capacity: $REQUIRED_CAPACITY ($MODEL_TYPE)"
132178

133179
MODEL_INFO=$(echo "$QUOTA_INFO" | awk -v model="\"value\": \"$MODEL_TYPE\"" '
134180
BEGIN { RS="},"; FS="," }
@@ -137,7 +183,7 @@ for REGION in "${REGIONS[@]}"; do
137183

138184
if [ -z "$MODEL_INFO" ]; then
139185
FOUND=false
140-
echo "⚠️ WARNING: No quota information found for model: $MODEL_NAME in region: $REGION for model type: $MODEL_TYPE."
186+
log_verbose "⚠️ WARNING: No quota information found for model: $MODEL_NAME in region: $REGION for model type: $MODEL_TYPE."
141187
continue
142188
fi
143189

@@ -153,7 +199,7 @@ for REGION in "${REGIONS[@]}"; do
153199
LIMIT=$(echo "$LIMIT" | cut -d'.' -f1)
154200

155201
AVAILABLE=$((LIMIT - CURRENT_VALUE))
156-
echo "✅ Model: $MODEL_TYPE | Used: $CURRENT_VALUE | Limit: $LIMIT | Available: $AVAILABLE"
202+
log_verbose "✅ Model: $MODEL_TYPE | Used: $CURRENT_VALUE | Limit: $LIMIT | Available: $AVAILABLE"
157203

158204
if [ "$AVAILABLE" -ge "$REQUIRED_CAPACITY" ]; then
159205
FOUND=true
@@ -168,9 +214,10 @@ for REGION in "${REGIONS[@]}"; do
168214
fi
169215

170216
if [ "$FOUND" = false ]; then
171-
echo "❌ No models found for model: $MODEL_NAME in region: $REGION (${MODEL_TYPES[*]})"
217+
log_verbose "❌ No models found for model: $MODEL_NAME in region: $REGION (${MODEL_TYPES[*]})"
218+
172219
elif [ "$INSUFFICIENT_QUOTA" = true ]; then
173-
echo "⚠️ Model $MODEL_NAME in region: $REGION has insufficient quota (${MODEL_TYPES[*]})."
220+
log_verbose "⚠️ Model $MODEL_NAME in region: $REGION has insufficient quota (${MODEL_TYPES[*]})."
174221
fi
175222
done
176223
done
@@ -200,4 +247,4 @@ else
200247
echo "➡️ To request a quota increase, visit: https://aka.ms/oai/stuquotarequest"
201248
fi
202249

203-
echo "✅ Script completed."
250+
echo "✅ Script completed."

0 commit comments

Comments
 (0)