CrispStrobe commited on
Commit
c36e329
·
unverified ·
1 Parent(s): 1d23a03

convert : handle max_target_positions (#2477)

Browse files

as needed eg for
https://huggingface.co/primeline/whisper-large-v3-turbo-german/blob/main/config.json

Files changed (1) hide show
  1. models/convert-h5-to-ggml.py +5 -1
models/convert-h5-to-ggml.py CHANGED
@@ -82,7 +82,11 @@ dir_out = Path(sys.argv[3])
82
 
83
  encoder = json.load((dir_model / "vocab.json").open("r", encoding="utf8"))
84
  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") )
 
 
 
 
86
 
87
  model = WhisperForConditionalGeneration.from_pretrained(dir_model)
88
 
 
82
 
83
  encoder = json.load((dir_model / "vocab.json").open("r", encoding="utf8"))
84
  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"))
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)
90
 
91
  model = WhisperForConditionalGeneration.from_pretrained(dir_model)
92