Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inspect.getfullargspec in module constructor causes problems with function wrappers #570

Open
jonkhler opened this issue Nov 16, 2022 · 0 comments

Comments

@jonkhler
Copy link

When trying to annotatedd haiku modules with jaxtyping type hints, I realized there is a general problem with function wrappers due to using the (semi-deprecated) inspect.getfullargspec in

https://github.com/deepmind/dm-haiku/blob/2664390c3df8af703b87bf62059eda25ca5eff57/haiku/_src/utils.py#L66

E.g. when you wrap the __init__ of a haiku module with a type checker then this call produces an error due to missing signature information (getfullargspec does not follow the full __wrapped__-chain).

https://github.com/deepmind/dm-haiku/blob/2664390c3df8af703b87bf62059eda25ca5eff57/haiku/_src/module.py#L126

See this PR to jaxtyping. As discussed with @patrick-kidger this seems to be a bug/incompatibility issue at the haiku side rather than forcing wrapper libraries to hard-patch a __signature__ attribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant