MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / get_arr_n

Method get_arr_n

smallthinker/src/llama-model-loader.cpp:262–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

load_hparamsMethod · 0.80

Calls 5

formatFunction · 0.70
llm_kvEnum · 0.70
gguf_find_keyFunction · 0.50
getMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected