Skip to content

Commit cd9a969

Browse files
committed
gguf-py, convert-hf : store decoder_start_token_id from T5 config.json in model header
1 parent 205fee3 commit cd9a969

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

convert-hf-to-gguf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2822,6 +2822,7 @@ def set_gguf_parameters(self):
28222822
self.gguf_writer.add_layer_norm_eps(self.hparams["layer_norm_epsilon"])
28232823
self.gguf_writer.add_relative_attn_buckets_count(self.hparams["relative_attention_num_buckets"])
28242824
self.gguf_writer.add_layer_norm_rms_eps(self.hparams["layer_norm_epsilon"])
2825+
self.gguf_writer.add_decoder_start_token_id(self.hparams["decoder_start_token_id"])
28252826
self.gguf_writer.add_file_type(self.ftype)
28262827

28272828

gguf-py/gguf/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class LLM:
4848
EXPERT_WEIGHTS_SCALE = "{arch}.expert_weights_scale"
4949
POOLING_TYPE = "{arch}.pooling_type"
5050
LOGIT_SCALE = "{arch}.logit_scale"
51+
DECODER_START_TOKEN_ID = "{arch}.decoder_start_token_id"
5152

5253
class Attention:
5354
HEAD_COUNT = "{arch}.attention.head_count"

gguf-py/gguf/gguf_writer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,9 @@ def add_expert_feed_forward_length(self, length: int) -> None:
397397
def add_parallel_residual(self, use: bool) -> None:
398398
self.add_bool(Keys.LLM.USE_PARALLEL_RESIDUAL.format(arch=self.arch), use)
399399

400+
def add_decoder_start_token_id(self, id: int) -> None:
401+
self.add_uint32(Keys.LLM.DECODER_START_TOKEN_ID.format(arch=self.arch), id)
402+
400403
def add_head_count(self, count: int) -> None:
401404
self.add_uint32(Keys.Attention.HEAD_COUNT.format(arch=self.arch), count)
402405

0 commit comments

Comments
 (0)