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