File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 5
5
from scipy .special import log_softmax
6
6
7
7
import llama_cpp
8
+ from llama_cpp .llama_metrics import MetricsExporter
8
9
9
10
MODEL = "./vendor/llama.cpp/models/ggml-vocab-llama-spm.gguf"
10
11
12
+ def set_test_metrics_exporter ():
13
+ global metrics_exporter
14
+ try :
15
+ metrics_exporter
16
+ except NameError :
17
+ metrics_exporter = MetricsExporter ()
18
+
19
+ return metrics_exporter
11
20
12
21
def test_llama_cpp_tokenization ():
13
22
llama = llama_cpp .Llama (model_path = MODEL , vocab_only = True , verbose = False )
@@ -156,7 +165,8 @@ def test_llama_patch(mock_llama):
156
165
ai_service_completion = "test-label-suggestions"
157
166
ai_service_streaming = "test-acceptance-criteria"
158
167
llama = llama_cpp .Llama (model_path = MODEL , vocab_only = True , n_ctx = n_ctx )
159
-
168
+ llama .metrics = set_test_metrics_exporter ()
169
+
160
170
n_vocab = llama_cpp .llama_n_vocab (llama ._model .model )
161
171
assert n_vocab == 32000
162
172
@@ -231,6 +241,7 @@ def test_llama_pickle():
231
241
232
242
def test_utf8 (mock_llama ):
233
243
llama = llama_cpp .Llama (model_path = MODEL , vocab_only = True , logits_all = True )
244
+ llama .metrics = set_test_metrics_exporter ()
234
245
235
246
output_text = "😀"
236
247
ai_service = "label-suggestions"
You can’t perform that action at this time.
0 commit comments