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 @@ -415,14 +415,17 @@ def main_export(
415
415
and getattr (model .config , "pad_token_id" , None ) is None
416
416
)
417
417
418
- if needs_pad_token_id and pad_token_id is None :
419
- tok = AutoTokenizer .from_pretrained (model_name_or_path )
420
- pad_token_id = getattr (tok , "pad_token_id" , None )
421
- if pad_token_id is None :
422
- raise ValueError (
423
- "Could not infer the pad token id, which is needed in this case, please provide it with the --pad_token_id argument"
424
- )
425
- model .config .pad_token_id = pad_token_id
418
+ if needs_pad_token_id :
419
+ if pad_token_id is not None :
420
+ model .config .pad_token_id = pad_token_id
421
+ else :
422
+ tok = AutoTokenizer .from_pretrained (model_name_or_path )
423
+ pad_token_id = getattr (tok , "pad_token_id" , None )
424
+ if pad_token_id is None :
425
+ raise ValueError (
426
+ "Could not infer the pad token id, which is needed in this case, please provide it with the --pad_token_id argument"
427
+ )
428
+ model .config .pad_token_id = pad_token_id
426
429
427
430
if "stable-diffusion" in task :
428
431
model_type = "stable-diffusion"
You can’t perform that action at this time.
0 commit comments