TypeError: param_init_embedding_layer() missing 2 required positional arguments: 'n_words' and 'dims
See original GitHub issueI have been trying to get nematus to work using the wmt16 model, but I think there is something wrong in the code. I tried to fix it but no matter what I (guessed) to change, it keeps crashing in different places. Here’s the root problem:
Warning: No built-in rules for language de.
Detokenizer Version $Revision: 4134 $
Language: de
Tokenizer Version 1.1
Language: en
Number of threads: 1
Translating <stdin> ...
Using cuDNN version 5110 on context None
Mapped name None to device cuda: GeForce GTX 960M (0000:01:00.0)
Process Process-1:
Traceback (most recent call last):
File "/usr/lib/python3.5/multiprocessing/process.py", line 249, in _bootstrap
self.run()
File "/usr/lib/python3.5/multiprocessing/process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "/media/data/translation/nematus/nematus/translate.py", line 54, in translate_model
f_init, f_next = build_sampler(tparams, option, use_noise, trng, return_alignment=return_alignment)
File "/media/data/translation/nematus/nematus/nmt.py", line 359, in build_sampler
x, ctx = build_encoder(tparams, options, trng, use_noise, x_mask=None, sampling=True)
File "/media/data/translation/nematus/nematus/nmt.py", line 186, in build_encoder
emb = get_layer_constr('embedding')(tparams, x, suffix='', factors= options['factors'])
TypeError: param_init_embedding_layer() missing 2 required positional arguments: 'n_words' and 'dims'
Error: translate worker process 10737 crashed with exitcode 1
If you look at layers.py
, line 76, I think it’s true. But where to get n_words
and dims
from?
Issue Analytics
- State:
- Created 6 years ago
- Comments:7
Top Results From Across the Web
TypeError: missing 2 required positional arguments (Python)
The Python TypeError: missing 2 required positional arguments occurs when we forget to provide 2 required arguments when calling a function or method....
Read more >TypeError: __init__() missing 2 required positional arguments
You have to specify the number of activations and the dimensions when you create the object: a = SET_MLP(activations = x, dimensions =...
Read more >Function() missing 2 required positional arguments - Python
TypeError : function() missing 2 required positional arguments: 'city1' ... to have function() , you could eliminate the parameters, and have
Read more >TypeError: __new__() missing 2 required positional arguments
A couple of fixes: from abc import ABC, abstractmethod. # not ABCMeta, which is where your error arises. assign_values_to_sides() in ...
Read more >doInOrden() missing 2 required positional arguments: 'probe ...
For me not much experience just run some code have face the error required two positional arguments probe and visit please help me...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh, excellent observation! Yes, the code is pretty much unmodified, except that I am using it with python 3.5 and had to adapt a few imports and the renamed
iteritems()
. The solution for my problem is this little typo:note the difference of
{
vs(
.embedding
returned a set instead of a tuple, and python 3 sorted the set according to string length, thus it had the wrong order. python 2.7 doesn’t sort strings in sets at all, it seems to me, so you were lucky 😉If you want, I can create a PR with all my python 3 changes.
Great! I still have the tab open as a TODO reminder, but I just won’t have enough time until December. Guess I’ll be able to close those tabs, too, then 😃