| 262 | |
| 263 | template<typename T> |
| 264 | typename std::enable_if<std::is_integral<T>::value, bool>::type |
| 265 | llama_model_loader::get_arr_n(const std::string & key, T & result, bool required) { |
| 266 | const int kid = gguf_find_key(meta.get(), key.c_str()); |
| 267 | |
| 268 | if (kid < 0) { |
| 269 | if (required) { |
| 270 | throw std::runtime_error(format("key not found in model: %s", key.c_str())); |
| 271 | } |
| 272 | return false; |
| 273 | } |
| 274 | |
| 275 | struct GGUFMeta::ArrayInfo arr_info = |
| 276 | GGUFMeta::GKV<GGUFMeta::ArrayInfo>::get_kv(meta.get(), kid); |
| 277 | |
| 278 | |
| 279 | result = arr_info.length; |
| 280 | return true; |
| 281 | } |
| 282 | |
| 283 | template<typename T> |
| 284 | typename std::enable_if<std::is_integral<T>::value, bool>::type |
no test coverage detected