| 29 | } |
| 30 | |
| 31 | static std::vector<prompt_case> load_prompt_cases(const std::string & path) { |
| 32 | std::vector<prompt_case> cases; |
| 33 | std::ifstream f(path); |
| 34 | std::string line; |
| 35 | while (std::getline(f, line)) { |
| 36 | if (line.empty()) { |
| 37 | continue; |
| 38 | } |
| 39 | |
| 40 | prompt_case pc; |
| 41 | size_t tab = line.find('\t'); |
| 42 | if (tab == std::string::npos) { |
| 43 | pc.id = "prompt_" + std::to_string(cases.size()); |
| 44 | pc.text = line; |
| 45 | } else { |
| 46 | pc.id = line.substr(0, tab); |
| 47 | pc.text = line.substr(tab + 1); |
| 48 | } |
| 49 | cases.push_back(std::move(pc)); |
| 50 | } |
| 51 | return cases; |
| 52 | } |
| 53 | |
| 54 | static std::string category_for_tensor(const std::string & name) { |
| 55 | if (name == "causal_mask") return "causal_mask"; |