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

Python Value Error at Transfer Task : MR #88

Closed
yuenherny opened this issue Jul 14, 2022 · 3 comments
Closed

Python Value Error at Transfer Task : MR #88

yuenherny opened this issue Jul 14, 2022 · 3 comments

Comments

@yuenherny
Copy link

I got the following error at Transfer Task : MR when running bow.py. It was fine when at Transfer Task : STS12, STS13, STS14, STS15, STS16.

  • Python: 3.10.5
  • Torch: 1.12.0+cu113
2022-07-14 09:23:16,630 : ***** Transfer task : MR *****


2022-07-14 09:23:23,417 : Found 18472 words with word vectors, out of         20328 words
2022-07-14 09:23:23,428 : Generating sentence embeddings
2022-07-14 09:23:23,891 : Generated sentence embeddings
2022-07-14 09:23:23,892 : Training pytorch-MLP-nhid0-rmsprop-bs128 with (inner) 5-fold cross-validation
Traceback (most recent call last):
  File "D:\XpressAI-Repos\SentEval\examples\bow.py", line 111, in <module>
    results = se.eval(transfer_tasks)
  File "D:\XpressAI-Repos\SentEval\examples\..\senteval\engine.py", line 59, in eval
    self.results = {x: self.eval(x) for x in name}
  File "D:\XpressAI-Repos\SentEval\examples\..\senteval\engine.py", line 59, in <dictcomp>
    self.results = {x: self.eval(x) for x in name}
  File "D:\XpressAI-Repos\SentEval\examples\..\senteval\engine.py", line 121, in eval
    self.results = self.evaluation.run(self.params, self.batcher)
  File "D:\XpressAI-Repos\SentEval\examples\..\senteval\binary.py", line 57, in run
    devacc, testacc = clf.run()
  File "D:\XpressAI-Repos\SentEval\examples\..\senteval\tools\validation.py", line 78, in run
    clf = MLP(self.classifier_config, inputdim=self.featdim,
  File "D:\XpressAI-Repos\SentEval\examples\..\senteval\tools\classifier.py", line 200, in __init__
    optim_fn, optim_params = utils.get_optimizer(self.optim)
  File "D:\XpressAI-Repos\SentEval\examples\..\senteval\utils.py", line 89, in get_optimizer
    expected_args = inspect.getargspec(optim_fn.__init__)[0]
  File "C:\Users\YuenHern.Yu\AppData\Local\Programs\Python\Python310\lib\inspect.py", line 1245, in getargspec
    raise ValueError("Function has keyword-only parameters or annotations"
ValueError: Function has keyword-only parameters or annotations, use inspect.signature() API which can support them

Is it a Python issue or SentEval issue?

@kaisugi
Copy link

kaisugi commented Jul 14, 2022

same error occurred

@kaisugi
Copy link

kaisugi commented Jul 14, 2022

After I comment out the following lines, I could run the program
I guess these lines are just for sanity check, so it should work without them

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()):
raise Exception('Unexpected parameters: expected "%s", got "%s"' % (
str(expected_args[2:]), str(optim_params.keys())))

@yuenherny
Copy link
Author

I think someone updated this part in this PR #87 . Hopefully this will be merged soon.

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

2 participants