char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
cb8f4fa3f
char/aliceai-t5-moe
1#include "ggml.h" 2#include "llama.h" 3#include "common.h" 4#include "ngram-cache.h" 5 6#include <clocale> 7#include <cstdint> 8#include <cstdio> 9#include <fstream> 10#include <iostream> 11#include <string> 12#include <unordered_map> 13#include <vector> 14 15static void print_usage (char * argv0 ) { 16fprintf (stderr ,"Merges multiple lookup cache files into a single one.\n" ); 17fprintf (stderr ,"Usage: %s [--help] lookup_part_1.bin lookup_part_2.bin ... lookup_merged.bin\n" ,argv0 ); 18} 19 20int main (int argc ,char ** argv ){ 21 std::setlocale (LC_NUMERIC ,"C" ); 22 23if (argc < 3 ) { 24print_usage (argv [0 ]); 25exit (1 ); 26 } 27 28 std::vector < std::string > args ; 29args .resize (argc - 1 ); 30for (int i = 0 ;i < argc - 1 ;++ i ) { 31args [i ]= argv [i + 1 ]; 32if (args [i ]== "-h" || args [i ]== "--help" ) { 33print_usage (argv [0 ]); 34exit (0 ); 35 } 36 } 37 38fprintf (stderr ,"lookup-merge: loading file %s\n" ,args [0 ].c_str ()); 39common_ngram_cache ngram_cache_merged = common_ngram_cache_load (args [0 ]); 40 41for (size_t i = 1 ;i < args .size ()- 1 ;++ i ) { 42fprintf (stderr ,"lookup-merge: loading file %s\n" ,args [i ].c_str ()); 43common_ngram_cache ngram_cache = common_ngram_cache_load (args [i ]); 44 45common_ngram_cache_merge (ngram_cache_merged ,ngram_cache ); 46 } 47 48fprintf (stderr ,"lookup-merge: saving file %s\n" ,args .back ().c_str ()); 49common_ngram_cache_save (ngram_cache_merged ,args .back ()); 50}