Skip to content

Commit 5070d0a

Browse files
fixup! lookup: evaluation tools, use corpus/previous gens
1 parent a51a401 commit 5070d0a

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

common/ngram-cache.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ void llama_ngram_cache_save(llama_ngram_cache & ngram_cache, std::string & filen
217217
llama_ngram_cache llama_ngram_cache_load(std::string & filename) {
218218
std::ifstream hashmap_file(filename, std::ios::binary);
219219
if (!hashmap_file) {
220-
throw std::system_error();
220+
throw std::ifstream::failure("Unable to open file " + filename);
221221
}
222222
llama_ngram_cache ngram_cache;
223223

examples/lookup/lookup-stats.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ int main(int argc, char ** argv){
5252
if (!params.lookup_cache_static.empty()) {
5353
try {
5454
ngram_cache_static = llama_ngram_cache_load(params.lookup_cache_static);
55-
} catch (std::system_error const &) {
55+
} catch (std::ifstream::failure const &) {
5656
fprintf(stderr, "error: failed to open static lookup cache: %s", params.lookup_cache_static.c_str());
5757
exit(1);
5858
}
@@ -61,7 +61,7 @@ int main(int argc, char ** argv){
6161
if (!params.lookup_cache_dynamic.empty()) {
6262
try {
6363
ngram_cache_dynamic = llama_ngram_cache_load(params.lookup_cache_dynamic);
64-
} catch (std::system_error const &) {} // if the file does not exist it will simply be created at the end of the program
64+
} catch (std::ifstream::failure const &) {} // if the file does not exist it will simply be created at the end of the program
6565
}
6666

6767
t_draft_flat_us += ggml_time_us() - t_start_draft_us;

examples/lookup/lookup.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include <cstdio>
99
#include <fstream>
1010
#include <string>
11-
#include <system_error>
1211
#include <vector>
1312
#include <unordered_map>
1413

@@ -63,7 +62,7 @@ int main(int argc, char ** argv){
6362
if (!params.lookup_cache_static.empty()) {
6463
try {
6564
ngram_cache_static = llama_ngram_cache_load(params.lookup_cache_static);
66-
} catch (std::system_error const &) {
65+
} catch (std::ifstream::failure const &) {
6766
fprintf(stderr, "error: failed to open static lookup cache: %s", params.lookup_cache_static.c_str());
6867
exit(1);
6968
}
@@ -72,7 +71,7 @@ int main(int argc, char ** argv){
7271
if (!params.lookup_cache_dynamic.empty()) {
7372
try {
7473
ngram_cache_dynamic = llama_ngram_cache_load(params.lookup_cache_dynamic);
75-
} catch (std::system_error const &) {} // if the file does not exist it will simply be created at the end of the program
74+
} catch (std::ifstream::failure const &) {} // if the file does not exist it will simply be created at the end of the program
7675
}
7776

7877
t_draft_flat_us += ggml_time_us() - t_start_draft_us;

0 commit comments

Comments
 (0)