| 512 | }; |
| 513 | |
| 514 | static gguf_split_info get_gguf_split_info(const std::string & path) { |
| 515 | static const std::regex re_split("^(.+)-([0-9]{5})-of-([0-9]{5})$", std::regex::icase); |
| 516 | std::smatch m; |
| 517 | |
| 518 | std::string prefix = path; |
| 519 | if (!string_remove_suffix(prefix, ".gguf")) { |
| 520 | return {}; |
| 521 | } |
| 522 | |
| 523 | int index = 1; |
| 524 | int count = 1; |
| 525 | |
| 526 | if (std::regex_match(prefix, m, re_split)) { |
| 527 | index = std::stoi(m[2].str()); |
| 528 | count = std::stoi(m[3].str()); |
| 529 | prefix = m[1].str(); |
| 530 | } |
| 531 | |
| 532 | return {std::move(prefix), index, count}; |
| 533 | } |
| 534 | |
| 535 | static std::pair<std::string, std::string> parse_manifest_name(std::string & filename) { |
| 536 | static const std::regex re(R"(^manifest=([^=]+)=([^=]+)=.*\.json$)"); |
no test coverage detected