File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -176,7 +176,6 @@ def __init__(
176
176
177
177
if self .verbose :
178
178
print (llama_cpp .llama_print_system_info ().decode ("utf-8" ), file = sys .stderr )
179
-
180
179
181
180
n_vocab = self .n_vocab ()
182
181
n_ctx = self .n_ctx ()
@@ -575,9 +574,9 @@ def create_embedding(
575
574
else :
576
575
inputs = input
577
576
578
- data = []
577
+ data : List [ EmbeddingData ] = []
579
578
total_tokens = 0
580
- for input in inputs :
579
+ for index , input in enumerate ( inputs ) :
581
580
tokens = self .tokenize (input .encode ("utf-8" ))
582
581
self .reset ()
583
582
self .eval (tokens )
@@ -587,20 +586,20 @@ def create_embedding(
587
586
: llama_cpp .llama_n_embd (self .ctx )
588
587
]
589
588
590
- if self .verbose :
591
- llama_cpp .llama_print_timings (self .ctx )
592
589
data .append (
593
590
{
594
591
"object" : "embedding" ,
595
592
"embedding" : embedding ,
596
- "index" : 0 ,
593
+ "index" : index ,
597
594
}
598
595
)
596
+ if self .verbose :
597
+ llama_cpp .llama_print_timings (self .ctx )
599
598
600
599
return {
601
600
"object" : "list" ,
602
601
"data" : data ,
603
- "model" : self . model_path ,
602
+ "model" : model_name ,
604
603
"usage" : {
605
604
"prompt_tokens" : total_tokens ,
606
605
"total_tokens" : total_tokens ,
You can’t perform that action at this time.
0 commit comments