facebookresearch / SentEval

A python tool for evaluating the quality of sentence embeddings.
Other
2.09k stars 309 forks source link

Python Value Error at Transfer Task : MR #88

Closed yuenherny closed 2 years ago

yuenherny commented 2 years ago

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.

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 commented 2 years ago

same error occurred

kaisugi commented 2 years ago

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

https://github.com/facebookresearch/SentEval/blob/5d6dc117d1ac30357ddaeb7347fb5684e9b87015/senteval/utils.py#L89-L93

yuenherny commented 2 years ago

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