File tree 1 file changed +8
-11
lines changed
1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -409,17 +409,14 @@ def main_export(
409
409
and getattr (model .config , "pad_token_id" , None ) is None
410
410
)
411
411
412
- if needs_pad_token_id :
413
- if pad_token_id is not None :
414
- model .config .pad_token_id = pad_token_id
415
- else :
416
- try :
417
- tok = AutoTokenizer .from_pretrained (model_name_or_path )
418
- model .config .pad_token_id = tok .pad_token_id
419
- except Exception :
420
- raise ValueError (
421
- "Could not infer the pad token id, which is needed in this case, please provide it with the --pad_token_id argument"
422
- )
412
+ if needs_pad_token_id and pad_token_id is None :
413
+ tok = AutoTokenizer .from_pretrained (model_name_or_path )
414
+ pad_token_id = getattr (tok , "pad_token_id" , None )
415
+ if pad_token_id is None :
416
+ raise ValueError (
417
+ "Could not infer the pad token id, which is needed in this case, please provide it with the --pad_token_id argument"
418
+ )
419
+ model .config .pad_token_id = pad_token_id
423
420
424
421
model_type = "stable-diffusion" if "stable-diffusion" in task else model .config .model_type .replace ("_" , "-" )
425
422
if (
You can’t perform that action at this time.
0 commit comments