File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -85,9 +85,15 @@ def bytes_to_unicode():
8585hparams  =  json .load ((dir_model  /  "config.json" ).open ("r" , encoding = "utf8" ))
8686
8787# 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- 
88+ if  "max_length"  not  in hparams  or  hparams ["max_length" ] is  None :
89+     hparams ["max_length" ] =  hparams .get ("max_target_positions" , 448 )  # Default to 448 if missing 
90+ elif  not  isinstance (hparams ["max_length" ], int ):
91+     try :
92+         hparams ["max_length" ] =  int (hparams ["max_length" ])  # Convert if necessary 
93+     except  ValueError :
94+         print (f"Warning: Invalid max_length value '{ hparams ['max_length' ]}  )
95+         hparams ["max_length" ] =  448 
96+         
9197model  =  WhisperForConditionalGeneration .from_pretrained (dir_model )
9298
9399#code.interact(local=locals()) 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments