Skip to content

Commit 3ca5a71

Browse files
committed
[aux] verbose gguf split
Show to which shards belongs each tensor
1 parent eb2e355 commit 3ca5a71

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tools/gguf-split/gguf-split.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ struct split_params {
4444
std::string output;
4545
bool no_tensor_first_split = false;
4646
bool dry_run = false;
47+
bool verbose = false;
4748
std::set<std::string> must_be_followed_layers;
4849
};
4950

@@ -65,6 +66,7 @@ static void split_print_usage(const char * executable) {
6566
printf(" --no-tensor-first-split do not add tensors to the first split (disabled by default)\n");
6667
printf(" --must-be-followed LAYER ensure LAYER is not the last tensor in a split and will not be released when loading after any tensor is created (can be used multiple times)\n");
6768
printf(" --dry-run only print out a split plan and exit, without writing any new files\n");
69+
printf(" --verbose show tensor names for each split\n");
6870
printf("\n");
6971
}
7072

@@ -110,6 +112,9 @@ static void split_params_parse_ex(int argc, const char ** argv, split_params & p
110112
} else if (arg == "--dry-run") {
111113
arg_found = true;
112114
params.dry_run = true;
115+
} else if (arg == "--verbose") {
116+
arg_found = true;
117+
params.verbose = true;
113118
} else if (arg == "--no-tensor-first-split") {
114119
arg_found = true;
115120
params.no_tensor_first_split = true;
@@ -322,6 +327,13 @@ struct split_strategy {
322327
}
323328
total_size = total_size / 1000 / 1000; // convert to megabytes
324329
printf("split %05d: n_tensors = %" PRIi64 ", total_size = %zuM\n", i_split + 1, gguf_get_n_tensors(ctx_out), total_size);
330+
331+
if (params.verbose) {
332+
for (int i = 0; i < gguf_get_n_tensors(ctx_out); ++i) {
333+
const char * t_name = gguf_get_tensor_name(ctx_out, i);
334+
printf(" - %s\n", t_name);
335+
}
336+
}
325337
i_split++;
326338
}
327339
}

0 commit comments

Comments
 (0)