File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -530,7 +530,7 @@ def from_pretrained(
530530 model_kwargs [param .name ] = config [param .name ]
531531
532532 # Check if `config` argument was passed at init
533- if "config" in cls ._hub_mixin_init_parameters :
533+ if "config" in cls ._hub_mixin_init_parameters and "config" not in model_kwargs :
534534 # Check if `config` argument is a dataclass
535535 config_annotation = cls ._hub_mixin_init_parameters ["config" ].annotation
536536 if config_annotation is inspect .Parameter .empty :
@@ -558,7 +558,7 @@ def from_pretrained(
558558 model_kwargs [key ] = value
559559
560560 # Finally, also inject if `_from_pretrained` expects it
561- if cls ._hub_mixin_inject_config :
561+ if cls ._hub_mixin_inject_config and "config" not in model_kwargs :
562562 model_kwargs ["config" ] = config
563563
564564 instance = cls ._from_pretrained (
You can’t perform that action at this time.
0 commit comments