nrl-qasrl icon indicating copy to clipboard operation
nrl-qasrl copied to clipboard

TypeError: from_params() takes 2 positional arguments but 4 were given

Open lx385095967 opened this issue 5 years ago β€’ 12 comments

After reading "QA-SRL", I ran the code after installing Allennlp 0.8.3. It reported an error:"TypeError: from_params() takes 2 positional arguments but 4 were given"

File "/home/lixin/Documents/qasrl-bank-master/nrl-qasrl-master/nrl/models/qasrl_parser.py", line 34, in from_params span_detector = Model.from_params(vocab, params.pop("span_detector")) TypeError: from_params() takes 2 positional arguments but 3 were given.

I can't find the function from_params() in the class 'model'. So,is it the reason for the framework version? How can i solve it .

I am a beginner, thank you for your help.

lx385095967 avatar Apr 18 '19 10:04 lx385095967

I meet a similar problem, but I have "3 were given"...πŸ˜‚ I do not know how to solve it ........

Erutan-pku avatar Apr 28 '19 06:04 Erutan-pku

I meet a similar problem, but I have "3 were given"...πŸ˜‚ I do not know how to solve it ........

If you run it on version 0.5.1 ,the demo can be operated. But training has some problems. If you get the result ,please tell me. Thanks.

lx385095967 avatar Apr 29 '19 02:04 lx385095967

I meet a similar problem, but I have "3 were given"...πŸ˜‚ I do not know how to solve it ........

If you run it on version 0.5.1 ,the demo can be operated. But training has some problems. If you get the result ,please tell me. Thanks.

Do you mean pytorch 0.4.1?
I have python3.6.5 with pytorch 0.4.1, but still have the problem when running "python3 -m allennlp.run predict ./data/qasrl_parser_elmo demo.txt --include-package nrl --predictor qasrl_parser --output-file demo.txt.out" The demo.txt is " {"sentence": "John went to the store."} {"sentence": "The man ate the burrito and threw the trash in the garbage"} "

I also met 2 import errors in "nrl/service/server_simple_gpu.py", I changed "from gevent.wsgi import WSGIServer" to "from gevent.pywsgi import WSGIServer" and comment out "from allennlp.service.server_flask import ServerError", I do not know whether it is OK...

Do you have any idea with these? Thanks.

Erutan-pku avatar Apr 29 '19 06:04 Erutan-pku

I meet a similar problem, but I have "3 were given"...πŸ˜‚ I do not know how to solve it ........

If you run it on version 0.5.1 ,the demo can be operated. But training has some problems. If you get the result ,please tell me. Thanks.

Do you mean pytorch 0.4.1? I have python3.6.5 with pytorch 0.4.1, but still have the problem when running "python3 -m allennlp.run predict ./data/qasrl_parser_elmo demo.txt --include-package nrl --predictor qasrl_parser --output-file demo.txt.out" The demo.txt is " {"sentence": "John went to the store."} {"sentence": "The man ate the burrito and threw the trash in the garbage"} "

I also met 2 import errors in "nrl/service/server_simple_gpu.py", I changed "from gevent.wsgi import WSGIServer" to "from gevent.pywsgi import WSGIServer" and comment out "from allennlp.service.server_flask import ServerError", I do not know whether it is OK...

Do you have any idea with these? Thanks.

allennlp version=0.5.1 你可δ»₯θ―•δΈ€δΈ‹

lx385095967 avatar Apr 29 '19 12:04 lx385095967

This code was built for allennlp 0.5.0 and pytorch 0.4.0.

nafitzgerald avatar Apr 29 '19 18:04 nafitzgerald

This code was built for allennlp 0.5.0 and pytorch

This code was built for allennlp 0.5.0 and pytorch 0.4.0.

OK, I will try later.Thanks for your reply.

lx385095967 avatar Apr 30 '19 02:04 lx385095967

This code was built for allennlp 0.5.0 and pytorch 0.4.0.

when I train the model, I face an error like this:

File "/home/leex/Documents/qasrl-bank-master/nrl-qasrl-master/nrl/metrics/threshold_metric.py", line 119, in get_matches matching = [(g, p) for g, p in matching.items() if g in gold_spans] AttributeError: 'set' object has no attribute 'items'

Platform: ubuntu 14/allennlp==0.5.1/torch==0.4.0

lx385095967 avatar Apr 30 '19 04:04 lx385095967

This code was built for allennlp 0.5.0 and pytorch 0.4.0.

That's works for predication, thank you~

I changed self._pretrained_vectors = read_pretrained_file("https://s3-us-west-2.amazonaws.com/allennlp/datasets/glove/glove.6B.100d.txt.gz") to
self._pretrained_vectors = read_pretrained_file("data/glove/glove.6B.100d.txt.gz") in nrl/service/predictors/qasrl_parser.py for utilizing local word embedding file.

Erutan-pku avatar Apr 30 '19 05:04 Erutan-pku

This code was built for allennlp 0.5.0 and pytorch 0.4.0.

That's works for predication, thank you~

I changed self._pretrained_vectors = read_pretrained_file("https://s3-us-west-2.amazonaws.com/allennlp/datasets/glove/glove.6B.100d.txt.gz") to self._pretrained_vectors = read_pretrained_file("data/glove/glove.6B.100d.txt.gz") in nrl/service/predictors/qasrl_parser.py for utilizing local word embedding file.

Have you run the training model smoothly?

lx385095967 avatar May 02 '19 02:05 lx385095967

This code was built for allennlp 0.5.0 and pytorch 0.4.0.

That's works for predication, thank you~ I changed self._pretrained_vectors = read_pretrained_file("https://s3-us-west-2.amazonaws.com/allennlp/datasets/glove/glove.6B.100d.txt.gz") to self._pretrained_vectors = read_pretrained_file("data/glove/glove.6B.100d.txt.gz") in nrl/service/predictors/qasrl_parser.py for utilizing local word embedding file.

Have you run the training model smoothly?

I did not run the training model, because I only need to parse several documents with the pretrained model ....

Erutan-pku avatar May 03 '19 03:05 Erutan-pku

I meet a similar problem, but I have "3 were given"...πŸ˜‚ I do not know how to solve it ........

If you run it on version 0.5.1 ,the demo can be operated. But training has some problems. If you get the result ,please tell me. Thanks.

Do you mean pytorch 0.4.1? I have python3.6.5 with pytorch 0.4.1, but still have the problem when running "python3 -m allennlp.run predict ./data/qasrl_parser_elmo demo.txt --include-package nrl --predictor qasrl_parser --output-file demo.txt.out" The demo.txt is " {"sentence": "John went to the store."} {"sentence": "The man ate the burrito and threw the trash in the garbage"} "

I also met 2 import errors in "nrl/service/server_simple_gpu.py", I changed "from gevent.wsgi import WSGIServer" to "from gevent.pywsgi import WSGIServer" and comment out "from allennlp.service.server_flask import ServerError", I do not know whether it is OK...

Do you have any idea with these? Thanks.

for the import error "allennlp.service.server_flask import ServerError", change it to "allennlp.service.server_simple import ServerError"

zhibiao-boston avatar Feb 24 '20 22:02 zhibiao-boston

This code was built for allennlp 0.5.0 and pytorch 0.4.0.

pytorch 0.4.0 is not available now.

zhibiao-boston avatar Feb 24 '20 22:02 zhibiao-boston