Skip to content

Commit ba8ae3f

Browse files
CrispStrobeliuyang.marshall
authored andcommitted
1 parent 601929f commit ba8ae3f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

models/convert-h5-to-ggml.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,11 @@ def bytes_to_unicode():
8282

8383
encoder = json.load((dir_model / "vocab.json").open("r", encoding="utf8"))
8484
encoder_added = json.load((dir_model / "added_tokens.json").open( "r", encoding="utf8"))
85-
hparams = json.load((dir_model / "config.json").open("r", encoding="utf8") )
85+
hparams = json.load((dir_model / "config.json").open("r", encoding="utf8"))
86+
87+
# Add this block to handle missing 'max_length'
88+
if "max_length" not in hparams:
89+
hparams["max_length"] = hparams.get("max_target_positions", 448)
8690

8791
model = WhisperForConditionalGeneration.from_pretrained(dir_model)
8892

0 commit comments

Comments
 (0)