Skip to content

Commit

Permalink
fixed decoder_start_token_id for T5 (#1552)
Browse files Browse the repository at this point in the history
* fixed decoder_start_token_id for T5, pad_token as default for decoder_start
---------

Co-authored-by: Ehsan Jahanbakhsh <[email protected]>
  • Loading branch information
Ehsan-Jahanbakhsh and Ehsan-Jahanbakhsh authored Nov 17, 2023
1 parent 120746e commit c5f46a3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion python/ctranslate2/converters/transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,12 @@ def set_config(self, config, model, tokenizer):
config.bos_token = tokenizer.pad_token
config.eos_token = tokenizer.eos_token
config.unk_token = tokenizer.unk_token
config.decoder_start_token = tokenizer.pad_token
if hasattr(model.config, "decoder_start_token_id"):
config.decoder_start_token = tokenizer.convert_ids_to_tokens(
model.config.decoder_start_token_id
)
else:
config.decoder_start_token = tokenizer.pad_token

def set_stack(self, spec, module, is_decoder=False):
self.set_layer_norm(spec.layer_norm, module.final_layer_norm)
Expand Down

0 comments on commit c5f46a3

Please sign in to comment.