Skip to content

Commit 20a75bc

Browse files
ggerganovjordankanter
authored andcommitted
scripts : parse wtype in server-llm.sh (ggml-org#5167)
* scripts : parse wtype in server-llm.sh * scripts : fix check for wfile
1 parent c6f5cb5 commit 20a75bc

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

scripts/server-llm.sh

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,28 @@ for wt in "${wtypes[@]}"; do
141141
wfiles+=("")
142142
done
143143

144+
# map wtype input to index
145+
if [[ ! -z "$wtype" ]]; then
146+
iw=-1
147+
is=0
148+
for wt in "${wtypes[@]}"; do
149+
# uppercase
150+
uwt=$(echo "$wt" | tr '[:lower:]' '[:upper:]')
151+
if [[ "$uwt" == "$wtype" ]]; then
152+
iw=$is
153+
break
154+
fi
155+
is=$((is+1))
156+
done
157+
158+
if [[ $iw -eq -1 ]]; then
159+
printf "[-] Invalid weight type: %s\n" "$wtype"
160+
exit 1
161+
fi
162+
163+
wtype="$iw"
164+
fi
165+
144166
# sample repos
145167
repos=(
146168
"https://huggingface.co/TheBloke/Llama-2-7B-GGUF"
@@ -252,8 +274,10 @@ for file in $model_files; do
252274
printf " %2d) %s %s\n" $iw "$have" "$file"
253275
done
254276

277+
wfile="${wfiles[$wtype]}"
278+
255279
# ask for weights type until provided and available
256-
while [[ -z "$wtype" ]]; do
280+
while [[ -z "$wfile" ]]; do
257281
printf "\n"
258282
read -p "[+] Select weight type: " wtype
259283
wfile="${wfiles[$wtype]}"

0 commit comments

Comments
 (0)