| 45 | }; |
| 46 | |
| 47 | static std::string read_file(const std::string & path) { |
| 48 | std::ifstream fin(path, std::ios::binary); |
| 49 | if (!fin.is_open()) { |
| 50 | throw std::runtime_error("Could not open file: " + path); |
| 51 | } |
| 52 | std::ostringstream buf; |
| 53 | buf << fin.rdbuf(); |
| 54 | return buf.str(); |
| 55 | } |
| 56 | |
| 57 | static std::string read_gguf_chat_template(const std::string & path) { |
| 58 | struct gguf_init_params params = { /*no_alloc =*/true, // We only need metadata, not tensor data |