diff --git a/examples/lookup-static/lookup-static.cpp b/examples/lookup-static/lookup-static.cpp index 4b63da4e3..9e68fa86f 100644 --- a/examples/lookup-static/lookup-static.cpp +++ b/examples/lookup-static/lookup-static.cpp @@ -3,11 +3,24 @@ #include #include +#include +#include #include #include #include int main(int argc, char ** argv){ + const char * static_input_file = "./wikitext-2-raw/wiki.test.raw"; + std::ifstream file(static_input_file); + if (!file) { + fprintf(stderr, "error: failed to open file '%s'\n", static_input_file); + exit(1); + } + std::string static_input; + std::copy(std::istreambuf_iterator(file), std::istreambuf_iterator(), back_inserter(static_input)); + if (!static_input.empty() && static_input.back() == '\n') { + static_input.pop_back(); + } gpt_params params; if (!gpt_params_parse(argc, argv, params)) {