-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Word features in Translation #1534
Comments
I am getting this error while training. example: महानगर│NN पालिका│NNPC अंतर्गत│JJ दत्तात्रय│NNPC नगर│NNPC माध्यमिक│NNPC स्कूल│NN के│PSP विद्यार्थियों│NN ने│PSP काल्पनिक│JJ किला│NN दत्तगढ़│NNP बनाकर│VM अपनी│PRP कल्पनाशक्ति│NN का│PSP परिचय│NN दिया│VM Traceback (most recent call last): Edit: It works if i use default options of train.py but not with the above mentioned command |
I figured out that if I use rnn_size to be equal to the total word_vec_size (i.e including feature dimensions), then it works. |
@vikrant97 your request is unclear to me. |
@vince62s Hi, I have two problems:-
P.S I edited the code to incorporate a list of feature_vec_sizes for different features F1, F2, F3... I hope my issue is clear? If yes, can you please help me out it in these two problems? |
ok, then what is the issue of setting for instance emb_size 500 feat_vec_size 6, hidden 512 |
@vince62s Yes that works fine because the total vec_size will come out to be 512 only (Therefore no conflicting issues with rrn_size). But the actual problem is: So I guess the trick you suggested will not work here or am I missing something? |
ok I see, what you are asking is in fact a duplicate of this: @bpopeters since you started to work onit, can you give him some pointers so that he can submit a PR ? |
Hi Vikrant,
The words’ features are back?
De: Vikrant Goyal [mailto:[email protected]]
Enviada em: quarta-feira, 21 de agosto de 2019 03:40
Para: OpenNMT/OpenNMT-py
Cc: Subscribed
Assunto: Re: [OpenNMT/OpenNMT-py] Word features in Translation (#1534)
I am getting this error while training.
Traning command:
python train.py -data ../data/word_with_pos_only -save_model ../models/word_with_pos_only_emb12 -layers 6 -rnn_size 512 -word_vec_size 500 -transformer_ff 2048 -heads 8 -encoder_type transformer -decoder_type transformer -position_encoding -train_steps 150000 -max_generator_batches 2 -dropout 0.3 -batch_size 4096 -batch_type tokens -normalization tokens -accum_count 2 -optim adam -adam_beta2 0.998 -decay_method noam -warmup_steps 8000 -learning_rate 1 -max_grad_norm 0 -param_init 0 -param_init_glorot -label_smoothing 0.1 -valid_steps 5000 -save_checkpoint_steps 20000 -world_size 1 -gpu_ranks 0
example: महानगर│NN पालिका│NNPC अंतर्गत│JJ दत्तात्रय│NNPC नगर│NNPC माध्यमिक│NNPC स्कूल│NN के│PSP विद्यार्थियों│NN ने│PSP काल्पनिक│JJ किला│NN दत्तगढ़│NNP बनाकर│VM अपनी│PRP कल्पनाशक्ति│NN का│PSP परिचय│NN दिया│VM
Traceback (most recent call last):
File "/home/vikrant.goyal/OpenNMT-py/train.py", line 109, in
main(opt)
File "/home/vikrant.goyal/OpenNMT-py/train.py", line 39, in main
single_main(opt, 0)
File "/home/vikrant.goyal/OpenNMT-py/onmt/train_single.py", line 127, in main
valid_steps=opt.valid_steps)
File "/home/vikrant.goyal/OpenNMT-py/onmt/trainer.py", line 249, in train
report_stats)
File "/home/vikrant.goyal/OpenNMT-py/onmt/trainer.py", line 364, in _gradient_accumulation
outputs, attns = self.model(src, tgt, src_lengths, bptt=bptt)
File "/home/vikrant.goyal/OpenNMT-py/myenv/lib/python3.5/site-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "/home/vikrant.goyal/OpenNMT-py/onmt/models/model.py", line 46, in forward
memory_lengths=lengths)
File "/home/vikrant.goyal/OpenNMT-py/myenv/lib/python3.5/site-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "/home/vikrant.goyal/OpenNMT-py/onmt/decoders/transformer.py", line 215, in forward
step=step)
File "/home/vikrant.goyal/OpenNMT-py/myenv/lib/python3.5/site-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "/home/vikrant.goyal/OpenNMT-py/onmt/decoders/transformer.py", line 69, in forward
input_norm = self.layer_norm_1(inputs)
File "/home/vikrant.goyal/OpenNMT-py/myenv/lib/python3.5/site-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(input, **kwargs)
File "/home/vikrant.goyal/OpenNMT-py/myenv/lib/python3.5/site-packages/torch/nn/modules/normalization.py", line 157, in forward
input, self.normalized_shape, self.weight, self.bias, self.eps)
File "/home/vikrant.goyal/OpenNMT-py/myenv/lib/python3.5/site-packages/torch/nn/functional.py", line 1725, in layer_norm
torch.backends.cudnn.enabled)
RuntimeError: Given normalized_shape=[512], expected input with shape [, 512], but got input of size[227, 16, 500]
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#1534?email_source=notifications&email_token=AFTBYL2ZMTJQIOZPVBSGJFTQFTPNXA5CNFSM4INS4EN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4YTRAQ#issuecomment-523319426>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AFTBYLZ3M6Q26BR26HMTXXDQFTPNXANCNFSM4INS4ENQ>.
|
Hi @eduamf |
@vince62s I have updated (locally) the OpenNMT code to incorporate word features on the source side. Traceback (most recent call last): |
If you want to discuss some of your code, please open e [WIP] PR and then we cansse what is going right and wrong. Without knowing what you have done, difficult to help. Most likely there could be an issue with your input features at inference. |
@vince62s The issue is solved & is working on my end. After this I will also look into target side features if that works and also limiting the feature vocab sizes to some particular threshold (becoz that's needed for features like lemma). |
Based on what's written here I have a model with 4 features. So I set feat vec size to be all the same. But I still get an error.
When I run with regular word vector size I also get the error
|
@Henry-E Just trying to document a bit this, when you have one extra feature of size 12 The 2 errors you reported are one from the encoder and one from the decoder. |
Thanks for following up. Are there any actions that you need from me to recreate this? |
I'm trying to run source features with a transformer, and I'm getting this error:
Here are my parameters:
|
Hi there, |
Hi @francoishernandez, thanks for the help! I tried what you suggested, and this is the output I got:
|
@vince62s Are there any plans to include source word features in the new data processing pipeline? They're widely used in many non-NMT applications such as NLG. |
Wow, closed as completed! |
No @anderleich is working on it, but it may take time. Just cleaning up old issues. |
I am trying to use word level features based on the paper "Linguistic Input Features Improve Neural Machine Translation", but couldn't find any correct documentation on how to use it.
I want to use different feature vector sizes for different features.
Can anyone help me out?
The text was updated successfully, but these errors were encountered: