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

Method file_input

smallthinker/tools/export-lora/export-lora.cpp:69–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67 float scale;
68
69 file_input(std::string & fname, float scale): f_in(fname, std::ios::binary), scale(scale) {
70 if (!f_in.is_open()) {
71 throw std::runtime_error("failed to open input gguf from " + fname);
72 }
73
74 ctx_gguf = load_gguf(fname, &ctx_meta);
75 alpha = get_kv_f32(ctx_gguf, "adapter.lora.alpha");
76 printf("%s: loaded gguf from %s\n", __func__, fname.c_str());
77
78 for (ggml_tensor * cur = ggml_get_first_tensor(ctx_meta); cur; cur = ggml_get_next_tensor(ctx_meta, cur)) {
79 std::string name(cur->name);
80 tensors[name] = cur;
81 if (g_verbose) {
82 printf("%s: %s\n", __func__, cur->name);
83 }
84 }
85 }
86
87 ggml_tensor * get_tensor(std::string name) {
88 if (tensors.find(name) == tensors.end()) {

Callers

nothing calls this directly

Calls 7

load_ggufFunction · 0.85
get_kv_f32Function · 0.85
printfFunction · 0.85
is_openMethod · 0.80
ggml_get_first_tensorFunction · 0.50
ggml_get_next_tensorFunction · 0.50
c_strMethod · 0.45

Tested by

no test coverage detected