From 2ea1ef909016484bee9d60c05582031464490f77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tianqi=20Zhang=20=28=E5=BC=A0=E5=A4=A9=E5=90=AF=29?= Date: Mon, 27 Feb 2023 15:57:57 +0800 Subject: [PATCH] [FX tracer] Make `concrete_args` from outside available (#21775) make concrete_args from outside available --- src/transformers/utils/fx.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/transformers/utils/fx.py b/src/transformers/utils/fx.py index 339ec1fc783111..da9c43b17195c4 100755 --- a/src/transformers/utils/fx.py +++ b/src/transformers/utils/fx.py @@ -984,7 +984,13 @@ def trace( continue if param.default is inspect.Parameter.empty: raise ValueError(f"You need to specify a default value for the parameter {param.name}.") - concrete_args.update({p.name: p.default for p in sig.parameters.values() if p.name not in dummy_inputs}) + concrete_args.update( + { + p.name: p.default + for p in sig.parameters.values() + if (p.name not in dummy_inputs and p.name not in concrete_args) + } + ) input_names = sig.parameters.keys() - concrete_args.keys()