mirror of
https://github.com/ikawrakow/ik_llama.cpp.git
synced 2026-02-20 13:14:09 +00:00
* spec : add self speculative decoding and ngram-mod and refactor common : use common_ prefix for common library function llama : use LLAMA_TOKEN_NULL spec : add self speculative decoding (no draft model required) + refactor spec : add ngram-mod spec : various improvements ton ngram-map + docs spec : fix the check-rate logic of ngram-simple common : add common_speculative_is_compat() spec : simplify time measurement using common_time_meas refactor common_sampler_init refactor common_token_to_piece refactor and fix cur_p bug clean up * spec : remove check rate * spec: show warnings instead of abort --------- Co-authored-by: firecoperana <firecoperana> Co-authored-by: Sascha Rogmann <59577610+srogmann@users.noreply.github.com>
48 lines
1.4 KiB
C++
48 lines
1.4 KiB
C++
#include "ggml.h"
|
|
#include "llama.h"
|
|
#include "common.h"
|
|
#include "ngram-cache.h"
|
|
|
|
#include <cstdint>
|
|
#include <cstdio>
|
|
#include <fstream>
|
|
#include <iostream>
|
|
#include <string>
|
|
#include <unordered_map>
|
|
#include <vector>
|
|
|
|
static void print_usage(char* argv0) {
|
|
fprintf(stderr, "Merges multiple lookup cache files into a single one.\n");
|
|
fprintf(stderr, "Usage: %s [--help] lookup_part_1.bin lookup_part_2.bin ... lookup_merged.bin\n", argv0);
|
|
}
|
|
|
|
int main(int argc, char ** argv){
|
|
if (argc < 3) {
|
|
print_usage(argv[0]);
|
|
exit(1);
|
|
}
|
|
|
|
std::vector<std::string> args;
|
|
args.resize(argc-1);
|
|
for (int i = 0; i < argc-1; ++i) {
|
|
args[i] = argv[i+1];
|
|
if (args[i] == "-h" || args[i] == "--help") {
|
|
print_usage(argv[0]);
|
|
exit(0);
|
|
}
|
|
}
|
|
|
|
fprintf(stderr, "lookup-merge: loading file %s\n", args[0].c_str());
|
|
common_ngram_cache ngram_cache_merged = common_ngram_cache_load(args[0]);
|
|
|
|
for (size_t i = 1; i < args.size()-1; ++i) {
|
|
fprintf(stderr, "lookup-merge: loading file %s\n", args[i].c_str());
|
|
common_ngram_cache ngram_cache = common_ngram_cache_load(args[i]);
|
|
|
|
common_ngram_cache_merge(ngram_cache_merged, ngram_cache);
|
|
}
|
|
|
|
fprintf(stderr, "lookup-merge: saving file %s\n", args.back().c_str());
|
|
common_ngram_cache_save(ngram_cache_merged, args.back());
|
|
}
|