bofenghuang commited on
Commit
07da7ec
·
1 Parent(s): 4503426

limit gen max token

Browse files
Files changed (1) hide show
  1. run_demo_multi_models.py +3 -0
run_demo_multi_models.py CHANGED
@@ -22,6 +22,7 @@ MODEL_NAMES = [
22
  "bhuang/whisper-medium-cv11-french-case-punctuation",
23
  ]
24
  CHUNK_LENGTH_S = 30
 
25
 
26
  logging.basicConfig(
27
  format="%(asctime)s [%(levelname)s] [%(name)s] %(message)s",
@@ -48,6 +49,8 @@ def maybe_load_cached_pipeline(model_name):
48
  )
49
  # set forced_decoder_ids
50
  pipe.model.config.forced_decoder_ids = pipe.tokenizer.get_decoder_prompt_ids(language="fr", task="transcribe")
 
 
51
 
52
  logger.info(f"`{model_name}` pipeline has been initialized")
53
 
 
22
  "bhuang/whisper-medium-cv11-french-case-punctuation",
23
  ]
24
  CHUNK_LENGTH_S = 30
25
+ MAX_NEW_TOKENS = 225
26
 
27
  logging.basicConfig(
28
  format="%(asctime)s [%(levelname)s] [%(name)s] %(message)s",
 
49
  )
50
  # set forced_decoder_ids
51
  pipe.model.config.forced_decoder_ids = pipe.tokenizer.get_decoder_prompt_ids(language="fr", task="transcribe")
52
+ # limit genneration max length
53
+ pipe.model.config.max_length = MAX_NEW_TOKENS + 1
54
 
55
  logger.info(f"`{model_name}` pipeline has been initialized")
56