From 4206bc02cb0eaa507478e6acc53cf6d6fb3c3ccd Mon Sep 17 00:00:00 2001 From: "yuenhern96@gmail.com" Date: Fri, 29 Jul 2022 20:49:26 +0800 Subject: [PATCH 1/2] update utils.py for py3.9+ compatibility --- senteval/utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/senteval/utils.py b/senteval/utils.py index 425f60cd..eafc9002 100644 --- a/senteval/utils.py +++ b/senteval/utils.py @@ -86,10 +86,10 @@ def get_optimizer(s): raise Exception('Unknown optimization method: "%s"' % method) # check that we give good parameters to the optimizer - expected_args = inspect.getargspec(optim_fn.__init__)[0] - assert expected_args[:2] == ['self', 'params'] - if not all(k in expected_args[2:] for k in optim_params.keys()): + 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[2:]), str(optim_params.keys()))) + str(expected_args.args[2:]), str(optim_params.keys()))) return optim_fn, optim_params From 4de9dc0c839f8060946b39ed62607bff659e383b Mon Sep 17 00:00:00 2001 From: "yuenhern96@gmail.com" Date: Fri, 29 Jul 2022 22:34:17 +0800 Subject: [PATCH 2/2] update utils.py for py3.9+ compatibility --- senteval/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/senteval/utils.py b/senteval/utils.py index eafc9002..03c273f5 100644 --- a/senteval/utils.py +++ b/senteval/utils.py @@ -87,9 +87,9 @@ def get_optimizer(s): # 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()): + assert expected_args[:2] == ['self', 'params'] + if not all(k in expected_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()))) + str(expected_args[2:]), str(optim_params.keys()))) return optim_fn, optim_params