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

Update utils.py for py3.9+ compatibility #1

Merged
merged 2 commits into from
Jul 29, 2022
Merged

Update utils.py for py3.9+ compatibility #1

merged 2 commits into from
Jul 29, 2022

Conversation

yuenherny
Copy link
Owner

Running the evaluation with Python 3.10.5 results in:
ValueError: Function has keyword-only parameters or annotations, use inspect.signature() API which can support them

Hence. replacing the legacy inspect.getargspec method with inspect.getfullargspec method, as per here:

# check that we give good parameters to the optimizer
    expected_args = inspect.getfullargspec(optim_fn.__init__)
    assert expected_args.args[:2] == ['self', 'params']
    if not all(k in expected_args.args[2:] for k in optim_params.keys()):
        raise Exception('Unexpected parameters: expected "%s", got "%s"' % (
            str(expected_args.args[2:]), str(optim_params.keys())))

This commit fixes this issue: facebookresearch#88. This fix was originated from this PR facebookresearch#87 which did not get merged after such a long time. Hence I forked this repo and implemented this fix myself.

Tested on Windows with Python 3.10.5.

@yuenherny yuenherny added the bug Something isn't working label Jul 29, 2022
@yuenherny yuenherny merged commit 2109c9e into main Jul 29, 2022
@yuenherny yuenherny deleted the update-py-func branch July 29, 2022 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant