Skip to content

Commit aa750c1

Browse files
authored
tests : minor bash stuff (ggml-org#6902)
* tests : minor bash stuff ggml-ci * llama : fix build ggml-ci * tests : fix CUR_DIR -> ROOT_DIR ggml-ci * tests : fix fname ggml-ci
1 parent 1966eb2 commit aa750c1

File tree

5 files changed

+23
-22
lines changed

5 files changed

+23
-22
lines changed

ci/run.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ function gg_run_test_scripts_debug {
161161
set -e
162162

163163
(cd ./examples/gguf-split && time bash tests.sh "$SRC/build-ci-debug/bin" "$MNT/models") 2>&1 | tee -a $OUT/${ci}-scripts.log
164+
(cd ./examples/quantize && time bash tests.sh "$SRC/build-ci-debug/bin" "$MNT/models") 2>&1 | tee -a $OUT/${ci}-scripts.log
164165

165166
set +e
166167
}
@@ -184,6 +185,7 @@ function gg_run_test_scripts_release {
184185
set -e
185186

186187
(cd ./examples/gguf-split && time bash tests.sh "$SRC/build-ci-release/bin" "$MNT/models") 2>&1 | tee -a $OUT/${ci}-scripts.log
188+
(cd ./examples/quantize && time bash tests.sh "$SRC/build-ci-release/bin" "$MNT/models") 2>&1 | tee -a $OUT/${ci}-scripts.log
187189

188190
set +e
189191
}

examples/gguf-split/tests.sh

100644100755
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@ set -eu
44

55
if [ $# -lt 1 ]
66
then
7-
echo "usage: $0 path_to_build_binary [path_to_temp_folder]"
8-
echo "example: $0 ../../build/bin ../../tmp"
9-
exit 1
7+
echo "usage: $0 path_to_build_binary [path_to_temp_folder]"
8+
echo "example: $0 ../../build/bin ../../tmp"
9+
exit 1
1010
fi
1111

1212
if [ $# -gt 1 ]
1313
then
14-
TMP_DIR=$2
14+
TMP_DIR=$2
1515
else
16-
TMP_DIR=/tmp
16+
TMP_DIR=/tmp
1717
fi
1818

1919
set -x
2020

2121
SPLIT=$1/gguf-split
2222
MAIN=$1/main
2323
WORK_PATH=$TMP_DIR/gguf-split
24-
CUR_DIR=$(pwd)
24+
ROOT_DIR=$(realpath $(dirname $0)/../../)
2525

2626
mkdir -p "$WORK_PATH"
2727

@@ -30,8 +30,8 @@ rm -f $WORK_PATH/ggml-model-split*.gguf $WORK_PATH/ggml-model-merge*.gguf
3030

3131
# 1. Get a model
3232
(
33-
cd $WORK_PATH
34-
"$CUR_DIR"/../../scripts/hf.sh --repo ggml-org/gemma-1.1-2b-it-Q8_0-GGUF --file gemma-1.1-2b-it.Q8_0.gguf
33+
cd $WORK_PATH
34+
"$ROOT_DIR"/scripts/hf.sh --repo ggml-org/gemma-1.1-2b-it-Q8_0-GGUF --file gemma-1.1-2b-it.Q8_0.gguf
3535
)
3636
echo PASS
3737

examples/quantize/test.sh renamed to examples/quantize/tests.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ set -eu
44

55
if [ $# -lt 1 ]
66
then
7-
echo "usage: $0 path_to_build_binary [path_to_temp_folder]"
8-
echo "example: $0 ../../build/bin ../../tmp"
9-
exit 1
7+
echo "usage: $0 path_to_build_binary [path_to_temp_folder]"
8+
echo "example: $0 ../../build/bin ../../tmp"
9+
exit 1
1010
fi
1111

1212
if [ $# -gt 1 ]
1313
then
14-
TMP_DIR=$2
14+
TMP_DIR=$2
1515
else
16-
TMP_DIR=/tmp
16+
TMP_DIR=/tmp
1717
fi
1818

1919
set -x
@@ -22,7 +22,7 @@ SPLIT=$1/gguf-split
2222
QUANTIZE=$1/quantize
2323
MAIN=$1/main
2424
WORK_PATH=$TMP_DIR/quantize
25-
CUR_DIR=$(pwd)
25+
ROOT_DIR=$(realpath $(dirname $0)/../../)
2626

2727
mkdir -p "$WORK_PATH"
2828

@@ -31,8 +31,8 @@ rm -f $WORK_PATH/ggml-model-split*.gguf $WORK_PATH/ggml-model-requant*.gguf
3131

3232
# 1. Get a model
3333
(
34-
cd $WORK_PATH
35-
"$CUR_DIR"/../../scripts/hf.sh --repo ggml-org/gemma-1.1-2b-it-Q8_0-GGUF --file gemma-1.1-2b-it.Q8_0.gguf
34+
cd $WORK_PATH
35+
"$ROOT_DIR"/scripts/hf.sh --repo ggml-org/gemma-1.1-2b-it-Q8_0-GGUF --file gemma-1.1-2b-it.Q8_0.gguf
3636
)
3737
echo PASS
3838

examples/server/tests/tests.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ set -eu
44

55
if [ $# -lt 1 ]
66
then
7-
# Start @llama.cpp scenario
8-
behave --summary --stop --no-capture --exclude 'issues|wrong_usages|passkey' --tags llama.cpp
7+
# Start @llama.cpp scenario
8+
behave --summary --stop --no-capture --exclude 'issues|wrong_usages|passkey' --tags llama.cpp
99
else
10-
behave "$@"
10+
behave "$@"
1111
fi
12-

llama.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14574,7 +14574,7 @@ static void llama_model_quantize_internal(const std::string & fname_inp, const s
1457414574
fout.close();
1457514575
}
1457614576
};
14577-
auto new_ofstream = [&](int index = 0) {
14577+
auto new_ofstream = [&](int index) {
1457814578
cur_split = index;
1457914579
GGML_ASSERT(ctx_outs[cur_split] && "Find uninitialized gguf_context");
1458014580
std::string fname = fname_out;
@@ -14592,7 +14592,7 @@ static void llama_model_quantize_internal(const std::string & fname_inp, const s
1459214592
};
1459314593

1459414594
const auto tn = LLM_TN(model.arch);
14595-
new_ofstream();
14595+
new_ofstream(0);
1459614596
for (int i = 0; i < ml.n_tensors; ++i) {
1459714597
auto weight = ml.get_weight(i);
1459814598
struct ggml_tensor * tensor = weight->tensor;

0 commit comments

Comments
 (0)