Spaces:
Running
Running
thefinaldegree
commited on
extra : update 'quantize-all.sh' to quantize all downloaded models (#1054)
Browse filesScript will now do what it says: quantize everything except testing models in the 'models' directory.
- extra/quantize-all.sh +36 -24
extra/quantize-all.sh
CHANGED
|
@@ -10,36 +10,48 @@ fi
|
|
| 10 |
qtype0="q5_0"
|
| 11 |
qtype1="q5_1"
|
| 12 |
upload="$1"
|
|
|
|
| 13 |
|
| 14 |
cd `dirname $0`
|
| 15 |
cd ../
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
./quantize ./models/ggml-base.en.bin ./models/ggml-base.en-${qtype1}.bin ${qtype1}
|
| 21 |
-
./quantize ./models/ggml-base.bin ./models/ggml-base-${qtype1}.bin ${qtype1}
|
| 22 |
|
| 23 |
-
./quantize ./models/ggml-small.en.bin ./models/ggml-small.en-${qtype1}.bin ${qtype1}
|
| 24 |
-
./quantize ./models/ggml-small.bin ./models/ggml-small-${qtype1}.bin ${qtype1}
|
| 25 |
-
|
| 26 |
-
./quantize ./models/ggml-medium.en.bin ./models/ggml-medium.en-${qtype0}.bin ${qtype0}
|
| 27 |
-
./quantize ./models/ggml-medium.bin ./models/ggml-medium-${qtype0}.bin ${qtype0}
|
| 28 |
-
|
| 29 |
-
./quantize ./models/ggml-large.bin ./models/ggml-large-${qtype0}.bin ${qtype0}
|
| 30 |
|
| 31 |
if [ "$upload" == "1" ]; then
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
scp ./models/ggml-small.en-${qtype1}.bin root@linode0:/mnt/Data/ggml/ggml-model-whisper-small.en-${qtype1}.bin
|
| 39 |
-
scp ./models/ggml-small-${qtype1}.bin root@linode0:/mnt/Data/ggml/ggml-model-whisper-small-${qtype1}.bin
|
| 40 |
-
|
| 41 |
-
scp ./models/ggml-medium.en-${qtype0}.bin root@linode0:/mnt/Data/ggml/ggml-model-whisper-medium.en-${qtype0}.bin
|
| 42 |
-
scp ./models/ggml-medium-${qtype0}.bin root@linode0:/mnt/Data/ggml/ggml-model-whisper-medium-${qtype0}.bin
|
| 43 |
-
|
| 44 |
-
scp ./models/ggml-large-${qtype0}.bin root@linode0:/mnt/Data/ggml/ggml-model-whisper-large-${qtype0}.bin
|
| 45 |
fi
|
|
|
|
| 10 |
qtype0="q5_0"
|
| 11 |
qtype1="q5_1"
|
| 12 |
upload="$1"
|
| 13 |
+
declare -a filedex
|
| 14 |
|
| 15 |
cd `dirname $0`
|
| 16 |
cd ../
|
| 17 |
|
| 18 |
+
# Let's loop across all the objects in the 'models' dir:
|
| 19 |
+
for i in ./models/*; do
|
| 20 |
+
# Check to see if it's a file or directory
|
| 21 |
+
if [ -d "$i" ]; then
|
| 22 |
+
# It's a directory! We should make sure it's not empty first:
|
| 23 |
+
if [ "$(ls -A $i)" ]; then
|
| 24 |
+
# Passed! Let's go searching for bin files (shouldn't need to go more than a layer deep here)
|
| 25 |
+
for f in "$i"/*.bin; do
|
| 26 |
+
# [Neuron Activation]
|
| 27 |
+
newfile=`echo "${f##*/}" | cut -d _ -f 1`;
|
| 28 |
+
if [ "$newfile" != "q5" ]; then
|
| 29 |
+
./quantize "${f}" "${i:-4}/${i:9:${#i}-4}-${qtype1}.bin" ${qtype1};
|
| 30 |
+
./quantize "${f}" "${i:-4}/${i:9:${#i}-4}-${qtype0}.bin" ${qtype0};
|
| 31 |
+
filedex+=( "${i:-4}/${i:9:${#i}-4}-${qtype1}.bin" "${i:-4}/${i:9:${#i}-4}-${qtype0}.bin" )
|
| 32 |
+
fi
|
| 33 |
+
done
|
| 34 |
+
fi
|
| 35 |
+
else
|
| 36 |
+
# It's a file! Let's make sure it's the right type:
|
| 37 |
+
if [ "${i##*.}" == "bin" ]; then
|
| 38 |
+
# And we probably want to skip the testing files
|
| 39 |
+
if [ "${i:9:8}" != "for-test" ]; then
|
| 40 |
+
# [Neuron Activation]
|
| 41 |
+
./quantize "${i}" "${i:-4}-${qtype1}.bin" ${qtype1};
|
| 42 |
+
./quantize "${i}" "${i:-4}-${qtype0}.bin" ${qtype0};
|
| 43 |
+
filedex+=( "${i:-4}-${qtype1}.bin" "${i:-4}-${qtype0}.bin" )
|
| 44 |
+
fi
|
| 45 |
+
fi
|
| 46 |
+
fi
|
| 47 |
+
done
|
| 48 |
|
|
|
|
|
|
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
if [ "$upload" == "1" ]; then
|
| 52 |
+
for i in ${!filedex[@]}; do
|
| 53 |
+
if [ "${filedex[$i]:9:8}" != "for-test" ]; then
|
| 54 |
+
scp ${filedex[$i]} root@linode0:/mnt/Data/ggml/ggml-model-${filedex[$i]:9}
|
| 55 |
+
fi
|
| 56 |
+
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
fi
|