From 0a3a2c4cd47943dc4c3c43be75728402584a3732 Mon Sep 17 00:00:00 2001 From: Iwan Kawrakow Date: Wed, 26 Jun 2024 17:38:18 +0300 Subject: imatrix: be able to specify the name of the output tensor For some models the same tensor is used for token embeddings and output. This tensor tends to be named token_embedding.weight rather than output.weight, which prevernts us from collecting imatrix data for this tensor. With this commit we can tell the name of the output tensor to the imatrix tool. --- common/common.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'common/common.cpp') diff --git a/common/common.cpp b/common/common.cpp index 64f160af..8eb23ade 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -1599,6 +1599,14 @@ bool gpt_params_find_arg(int argc, char ** argv, const std::string & arg, gpt_pa params.process_output = true; return true; } + if (arg == "--output-tensor-name") { + if (++i >= argc) { + invalid_param = true; + return true; + } + params.output_tensor_name = argv[i]; + return true; + } if (arg == "--no-ppl") { params.compute_ppl = false; return true; -- cgit v1.2.3