fixup! lookup: evaluation tools, use corpus/previous gens

This commit is contained in:
Johannes Gäßler 2024-03-22 23:28:03 +01:00
parent a51a401dcd
commit 5070d0a0f8
3 changed files with 5 additions and 6 deletions

View file

@ -217,7 +217,7 @@ void llama_ngram_cache_save(llama_ngram_cache & ngram_cache, std::string & filen
llama_ngram_cache llama_ngram_cache_load(std::string & filename) {
std::ifstream hashmap_file(filename, std::ios::binary);
if (!hashmap_file) {
throw std::system_error();
throw std::ifstream::failure("Unable to open file " + filename);
}
llama_ngram_cache ngram_cache;

View file

@ -52,7 +52,7 @@ int main(int argc, char ** argv){
if (!params.lookup_cache_static.empty()) {
try {
ngram_cache_static = llama_ngram_cache_load(params.lookup_cache_static);
} catch (std::system_error const &) {
} catch (std::ifstream::failure const &) {
fprintf(stderr, "error: failed to open static lookup cache: %s", params.lookup_cache_static.c_str());
exit(1);
}
@ -61,7 +61,7 @@ int main(int argc, char ** argv){
if (!params.lookup_cache_dynamic.empty()) {
try {
ngram_cache_dynamic = llama_ngram_cache_load(params.lookup_cache_dynamic);
} catch (std::system_error const &) {} // if the file does not exist it will simply be created at the end of the program
} catch (std::ifstream::failure const &) {} // if the file does not exist it will simply be created at the end of the program
}
t_draft_flat_us += ggml_time_us() - t_start_draft_us;

View file

@ -8,7 +8,6 @@
#include <cstdio>
#include <fstream>
#include <string>
#include <system_error>
#include <vector>
#include <unordered_map>
@ -63,7 +62,7 @@ int main(int argc, char ** argv){
if (!params.lookup_cache_static.empty()) {
try {
ngram_cache_static = llama_ngram_cache_load(params.lookup_cache_static);
} catch (std::system_error const &) {
} catch (std::ifstream::failure const &) {
fprintf(stderr, "error: failed to open static lookup cache: %s", params.lookup_cache_static.c_str());
exit(1);
}
@ -72,7 +71,7 @@ int main(int argc, char ** argv){
if (!params.lookup_cache_dynamic.empty()) {
try {
ngram_cache_dynamic = llama_ngram_cache_load(params.lookup_cache_dynamic);
} catch (std::system_error const &) {} // if the file does not exist it will simply be created at the end of the program
} catch (std::ifstream::failure const &) {} // if the file does not exist it will simply be created at the end of the program
}
t_draft_flat_us += ggml_time_us() - t_start_draft_us;