char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
14e733e36
char/aliceai-t5-moe
1#include "arg.h" 2#include "common.h" 3#include "ngram-cache.h" 4#include "llama.h" 5 6#include <clocale> 7#include <string> 8#include <vector> 9 10int main (int argc ,char ** argv ){ 11 std::setlocale (LC_NUMERIC ,"C" ); 12 13common_params params ; 14 15common_init (); 16 17if (!common_params_parse (argc ,argv ,params ,LLAMA_EXAMPLE_LOOKUP )) { 18return 1 ; 19 } 20 21// init llama.cpp 22llama_backend_init (); 23llama_numa_init (params .numa ); 24 25// load the model 26auto llama_init = common_init_from_params (params ); 27 28auto * model = llama_init -> model (); 29auto * ctx = llama_init -> context (); 30 31GGML_ASSERT (model != nullptr ); 32 33// tokenize the prompt 34 std::vector < llama_token > inp ; 35inp = common_tokenize (ctx ,params .prompt , true, true); 36fprintf (stderr ,"%s: tokenization done\n" ,__func__ ); 37 38common_ngram_cache ngram_cache ; 39common_ngram_cache_update (ngram_cache ,LLAMA_NGRAM_STATIC ,LLAMA_NGRAM_STATIC ,inp ,inp .size (), true); 40fprintf (stderr ,"%s: hashing done, writing file to %s\n" ,__func__ ,params .speculative .ngram_cache .lookup_cache_static .c_str ()); 41 42common_ngram_cache_save (ngram_cache ,params .speculative .ngram_cache .lookup_cache_static ); 43 44return 0 ; 45}