From 03f7e335604b3d68f74995aa2ccb4955833ee423 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Sat, 25 Mar 2023 20:51:14 +0200 Subject: Cleanup STL headers + fix embedding examples + minor stuff --- examples/embedding/embedding.cpp | 15 +++++---------- examples/perplexity/perplexity.cpp | 8 -------- 2 files changed, 5 insertions(+), 18 deletions(-) (limited to 'examples') diff --git a/examples/embedding/embedding.cpp b/examples/embedding/embedding.cpp index 3015293..d397f35 100644 --- a/examples/embedding/embedding.cpp +++ b/examples/embedding/embedding.cpp @@ -1,15 +1,6 @@ #include "common.h" #include "llama.h" -#include -#include -#include -#include -#include -#include -#include -#include - int main(int argc, char ** argv) { gpt_params params; params.model = "models/llama-7B/ggml-model.bin"; @@ -94,9 +85,13 @@ int main(int argc, char ** argv) { } } + const int n_embd = llama_n_embd(ctx); const auto embeddings = llama_get_embeddings(ctx); - // TODO: print / use the embeddings + for (int i = 0; i < n_embd; i++) { + printf("%f ", embeddings[i]); + } + printf("\n"); } llama_print_timings(ctx); diff --git a/examples/perplexity/perplexity.cpp b/examples/perplexity/perplexity.cpp index f0266a0..f617ba3 100644 --- a/examples/perplexity/perplexity.cpp +++ b/examples/perplexity/perplexity.cpp @@ -1,14 +1,6 @@ #include "common.h" #include "llama.h" -#include -#include -#include -#include -#include -#include -#include - std::vector softmax(const std::vector& logits) { std::vector probs(logits.size()); float max_logit = logits[0]; -- cgit v1.2.3