Skip to content

Commit

Permalink
convert : handle max_target_positions (#2477)
Browse files Browse the repository at this point in the history
  • Loading branch information
CrispStrobe authored Oct 14, 2024
1 parent 746d173 commit 06a1da9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion models/convert-h5-to-ggml.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ def bytes_to_unicode():

encoder = json.load((dir_model / "vocab.json").open("r", encoding="utf8"))
encoder_added = json.load((dir_model / "added_tokens.json").open( "r", encoding="utf8"))
hparams = json.load((dir_model / "config.json").open("r", encoding="utf8") )
hparams = json.load((dir_model / "config.json").open("r", encoding="utf8"))

# Add this block to handle missing 'max_length'
if "max_length" not in hparams:
hparams["max_length"] = hparams.get("max_target_positions", 448)

model = WhisperForConditionalGeneration.from_pretrained(dir_model)

Expand Down

0 comments on commit 06a1da9

Please sign in to comment.