提交 634f92fe 编写于 作者: M Megvii Engine Team

fix(mge/tm): remove annotations in argspec for tm compatibility

GitOrigin-RevId: 9d49077e458aa367fd76dadc93b6318bc9b7f954
上级 06d9fc14
...@@ -2474,6 +2474,12 @@ def trace_module( ...@@ -2474,6 +2474,12 @@ def trace_module(
if hasattr(mod, "argspec") if hasattr(mod, "argspec")
else inspect.getfullargspec(mod.forward) else inspect.getfullargspec(mod.forward)
) )
if isinstance(forward_argspec, inspect.FullArgSpec):
argspec_dict = forward_argspec._asdict()
# check defaults
tree_flatten((forward_argspec.defaults, forward_argspec.kwonlydefaults))
argspec_dict["annotations"] = {}
forward_argspec = inspect.FullArgSpec(**argspec_dict)
args, kwargs = _convert_kwargs_to_args(forward_argspec, args, kwargs, True) args, kwargs = _convert_kwargs_to_args(forward_argspec, args, kwargs, True)
inputs, _ = tree_flatten((args, kwargs)) inputs, _ = tree_flatten((args, kwargs))
for _, i in enumerate(inputs): for _, i in enumerate(inputs):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册