Skip to content

Commit 3f84682

Browse files
authored
add output labels to gguf
1 parent e9dc001 commit 3f84682

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

convert_hf_to_gguf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3695,6 +3695,10 @@ def set_gguf_parameters(self):
36953695
self.gguf_writer.add_causal_attention(False)
36963696
self._try_set_pooling_type()
36973697

3698+
if cls_out_labels := self.hparams.get("id2label"):
3699+
key_name = gguf.Keys.Classifier.OUTPUT_LABELS.format(arch = gguf.MODEL_ARCH_NAMES[self.model_arch])
3700+
self.gguf_writer.add_array(key_name, [v for k, v in sorted(cls_out_labels.items())])
3701+
36983702
def set_vocab(self):
36993703
tokens, toktypes, tokpre = self.get_vocab_base()
37003704
self.vocab_size = len(tokens)

0 commit comments

Comments
 (0)