-
Notifications
You must be signed in to change notification settings - Fork 89
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
Coversion issue #1
Comments
Hi Manni,
I guess it is an inconsistent issue between PyTorch on Python2 and Python3.
I will try to fixed if ASAP.
Thanks.
…On Fri, Nov 10, 2017 at 2:06 PM, Manni Singh ***@***.***> wrote:
Hi,
I am getting following error, Any suggestions?
Thanks
------------------------------
TypeError Traceback (most recent call last)
in ()
11 word, char, _, _, labels, masks, lengths = conll03_data.get_batch_variable(data_train,
batch_size)
12 optim.zero_grad()
---> 13 loss = network.loss(word, char, labels, mask=masks)
14 loss.backward()
15 optim.step()
~/NeuroNLP2/neuronlp2/models/sequence_labeling.py in loss(self,
input_word, input_char, target, mask, length, hx)
291 def loss(self, input_word, input_char, target, mask=None, length=None,
hx=None):
292 # output from rnn [batch, length, tag_space]
--> 293 output, _, mask, length = self._get_rnn_output(input_word,
input_char, mask=mask, length=length, hx=hx)
294
295 if length is not None:
~/NeuroNLP2/neuronlp2/models/sequence_labeling.py in
_get_rnn_output(self, input_word, input_char, mask, length, hx)
252
253 # [batch, length, char_length, char_dim]
--> 254 char = self.char_embedd(input_char)
255 char_size = char.size()
256 # first transform to [batch *length, char_length, char_dim]
/anaconda/lib/python3.6/site-packages/torch/nn/modules/module.py in *call*(self,
*input, **kwargs)
222 for hook in self._forward_pre_hooks.values():
223 hook(self, input)
--> 224 result = self.forward(*input, **kwargs)
225 for hook in self._forward_hooks.values():
226 hook_result = hook(self, input, result)
~/NeuroNLP2/neuronlp2/nn/modules/sparse.py in forward(self, input)
68 if input.dim() > 2:
69 num_inputs = np.prod(input_size[:-1])
---> 70 input = input.view(num_inputs, input_size[-1])
71
72 output_size = input_size + (self.embedding_dim, )
/anaconda/lib/python3.6/site-packages/torch/autograd/variable.py in
view(self, *sizes)
508
509 def view(self, *sizes):
--> 510 return View.apply(self, sizes)
511
512 def view_as(self, tensor):
/anaconda/lib/python3.6/site-packages/torch/autograd/_functions/tensor.py
in forward(ctx, i, sizes)
94 ctx.new_sizes = sizes
95 ctx.old_size = i.size()
---> 96 result = i.view(*sizes)
97 ctx.mark_shared_storage((i, result))
98 return result
TypeError: view received an invalid combination of arguments - got
(numpy.int64, int), but expected one of:
- (int ... size)
didn't match because some of the arguments have invalid types:
(numpy.int64, int)
- (torch.Size size)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADUtlhLrPt7kJ7EgXeDODmDvSnCJzBzmks5s1J7FgaJpZM4QZ-pG>
.
--
------------------
Best regards,
Ma,Xuezhe
Language Technologies Institute,
School of Computer Science,
Carnegie Mellon University
Tel: +1 206-512-5977
|
Thanks Max, i will wait for it. |
Hi Manni, Please try again to see if it works now. |
Thanks it Works, This one gives: Without any early stop: Lasagne code gives: Under settings : (mentioned in your paper), loading embedding: glove from /data/manni/ner/glove/glove.6B.100d.txt.gz settings: |
Hi Manni, It seems that there are some issues in your data. Please make sure that you follows the data format describe here #2 |
Moreover, PyTorch has some implicit parameter initialization which makes the training of the first few epochs unstable. When you see a pretty large loss at the beginning of the training (like 50+), just kill the program and re-run it :) |
Hi Max,
But still (1% improvement i got): Epoch 100 (LSTM(std), learning rate=0.0025, decay rate=0.0500 (1)): |
Hi Manni,
It seams you did not update to the latest version. Please pull first then
run it again.
If it still cannot obtain comparable performance. would you please paste
your complete log here?
…On Sun, Nov 19, 2017 at 8:13 AM, Manni Singh ***@***.***> wrote:
Hi Max,
- Cleaned everything
- Error starts < 15
- I converted data to BIOES
- Did not remove "-docstart-" sentences, i noticed from your log that
says, "Total number of data: 14987".
But still (1% improvement i got):
Epoch 100 (LSTM(std), learning rate=0.0025, decay rate=0.0500 (1)):
1499/1499 [===========================>] - ETA: 8s - train loss: 0.0395,
time: 126.78s
dev acc: 97.68%, precision: 89.58%, recall: 87.28%, F1: 88.42%
best dev acc: 97.87%, precision: 90.29%, recall: 88.44%, F1: 89.36%
(epoch: 21)
best test acc: 96.17%, precision: 83.23%, recall: 81.80%, F1: 82.51%
(epoch: 21)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADUtlictchyB2rxyeWFlslSDcaqT5ki9ks5s4Cl6gaJpZM4QZ-pG>
.
--
------------------
Best regards,
Ma,Xuezhe
Language Technologies Institute,
School of Computer Science,
Carnegie Mellon University
Tel: +1 206-512-5977
|
HI Max, Following is the log: loading embedding: glove from /data/manni/ner/glove/glove.6B.100d.txt.gz After Epoch 100: Epoch 100 (LSTM(std), learning rate=0.0025, decay rate=0.0500 (1)): |
Hi Manni,
After seeing your log, I guess the issue might be your word embedding.
There are 11948 words that are not included in your embedding dict, while
the number in my case is only 339.
Please make sure to use the correct GloVe 6B embedding.
Moreover, according to your log, I believe that you are not working on the
latest version. That might be another possible issue.
Thanks.
…On Mon, Nov 20, 2017 at 12:01 PM, Manni Singh ***@***.***> wrote:
HI Max,
I did clone, that is why it is working.
*Following is the log:*
loading embedding: glove from /data/manni/ner/glove/glove.6B.100d.txt.gz
2017-11-19 09:08:22,562 - NERCRF - INFO - Creating Alphabets
2017-11-19 09:08:22,565 - Create Alphabets - INFO - Creating Alphabets:
/data/manni/alphabets/ner_crf/
2017-11-19 09:08:23,173 - Create Alphabets - INFO - Total Vocabulary Size:
23625
2017-11-19 09:08:23,175 - Create Alphabets - INFO - TOtal Singleton Size:
11641
2017-11-19 09:08:23,180 - Create Alphabets - INFO - Total Vocabulary Size
(w.o rare words): 11984
2017-11-19 09:08:23,351 - Create Alphabets - INFO - Word Alphabet Size
(Singleton): 11985 (0)
2017-11-19 09:08:23,352 - Create Alphabets - INFO - Character Alphabet
Size: 86
2017-11-19 09:08:23,353 - Create Alphabets - INFO - POS Alphabet Size: 47
2017-11-19 09:08:23,354 - Create Alphabets - INFO - Chunk Alphabet Size: 19
2017-11-19 09:08:23,355 - Create Alphabets - INFO - NER Alphabet Size: 18
2017-11-19 09:08:23,357 - NERCRF - INFO - Word Alphabet Size: 11985
2017-11-19 09:08:23,358 - NERCRF - INFO - Character Alphabet Size: 86
2017-11-19 09:08:23,359 - NERCRF - INFO - POS Alphabet Size: 47
2017-11-19 09:08:23,360 - NERCRF - INFO - Chunk Alphabet Size: 19
2017-11-19 09:08:23,361 - NERCRF - INFO - NER Alphabet Size: 18
2017-11-19 09:08:23,362 - NERCRF - INFO - Reading Data
Reading data from /data/manni/ner/conll2003/eng.bioes.train
reading data: 10000
Total number of data: 14987
Reading data from /data/manni/ner/conll2003/eng.bioes.testa
Total number of data: 3466
Reading data from /data/manni/ner/conll2003/eng.bioes.testb
Total number of data: 3684
oov: 11984
2017-11-19 09:08:36,198 - NERCRF - INFO - constructing network...
2017-11-19 09:08:36,776 - NERCRF - INFO - Network: LSTM, num_layer=1,
hidden=200, filter=30, tag_space=128, crf=bigram
2017-11-19 09:08:36,777 - NERCRF - INFO - training: l2: 0.000000,
(#training data: 14987, batch: 10, dropout: 0.50)
*After Epoch 100:*
Epoch 100 (LSTM(std), learning rate=0.0025, decay rate=0.0500 (1)):
dev acc: 97.68%, precision: 89.58%, recall: 87.28%, F1: 88.42%
best dev acc: 97.87%, precision: 90.29%, recall: 88.44%, F1: 89.36%
(epoch: 21)
best test acc: 96.17%, precision: 83.23%, recall: 81.80%, F1: 82.51%
(epoch: 21)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADUtliuKLSMTMXE65SRLj2tiHzlZrVgjks5s4bB7gaJpZM4QZ-pG>
.
--
------------------
Best regards,
Ma,Xuezhe
Language Technologies Institute,
School of Computer Science,
Carnegie Mellon University
Tel: +1 206-512-5977
|
The orignal composition of glove to conll2003 i calculated is: Glove Vocab length:400000 Now the result is: Epoch 41 (LSTM(std), learning rate=0.0050, decay rate=0.0500 (1)): |
The trick I used for handle OOV is I first lookup the word in GloVe. If it
is not there, we lookup the lower case of the word in GloVe, again. It can
significantly reduce the number of OOV.
…On Tue, Nov 21, 2017 at 9:09 AM, Manni Singh ***@***.***> wrote:
- I lowered words in "conll03_data.py"
- Also did same in "reader.py"
- Now the oov is 476 and getting F1:91+
But why OOV is so less (I have "normalize_digits=False")? Are you
doing Masking somewhere?
*The orignal composition of glove to conll2003 i calculated is:*
Glove Vocab length:400000
Vocab length:21009
Vocab length:9002
Vocab length:8548
Total Vocab: 26869
Total OOV: 3922
Epoch 41 (LSTM(std), learning rate=0.0050, decay rate=0.0500 (1)):
1499/1499 [===========================>] - ETA: 8s - train: 61459 loss:
0.1576, time: 126.63s
dev acc: 98.81%, precision: 94.80%, recall: 94.58%, F1: 94.69%
best dev acc: 98.81%, precision: 94.80%, recall: 94.58%, F1: 94.69%
(epoch: 41)
best test acc: 97.93%, precision: 91.26%, recall: 90.92%, F1: 91.09%
(epoch: 41)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADUtlvjyfyqjDRmjuEufCCkS9YkgYOVYks5s4tmigaJpZM4QZ-pG>
.
--
------------------
Best regards,
Ma,Xuezhe
Language Technologies Institute,
School of Computer Science,
Carnegie Mellon University
Tel: +1 206-512-5977
|
I noticed that in the code. But, to my knowledge, the 6B GloVe is uncased. Also, there are many non-word elements (Digits, Punkts etc.) in Conll2003 English dataset are you masking those? |
No, I did not mask those.
I guess another possible reason is that when I create the vocabulary, i
throw away the singletons that do not appear in GloVe.
…On Tue, Nov 21, 2017 at 4:48 PM, Manni Singh ***@***.***> wrote:
I noticed that in the code. But, to my knowledge, the 6B GloVe is uncased.
Also, there are many non-word elements (Digits, Punkts etc.) in Conll2003
English dataset are you masking those?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADUtlih2nYtHKEhMmjQ33d_aegzDXNJKks5s40UugaJpZM4QZ-pG>
.
--
------------------
Best regards,
Ma,Xuezhe
Language Technologies Institute,
School of Computer Science,
Carnegie Mellon University
Tel: +1 206-512-5977
|
So does that mean, you considering them(singletons) "unk" ? |
Yes, if a singleton is excluded in the vocabulary, it will be regarded as
'UNK'.
…On Tue, Nov 21, 2017 at 5:00 PM, Manni Singh ***@***.***> wrote:
So does tha mean, you considering them(singletons) "unk" ?
BTW, That seems a good idea for generalisation!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADUtloaBT6sJSW_7ihZWCcYTY6vyKfCGks5s40gGgaJpZM4QZ-pG>
.
--
------------------
Best regards,
Ma,Xuezhe
Language Technologies Institute,
School of Computer Science,
Carnegie Mellon University
Tel: +1 206-512-5977
|
Great! Thanks i will try that. |
Hi,
I am getting following error, Any suggestions?
Thanks
TypeError Traceback (most recent call last)
in ()
11 word, char, _, _, labels, masks, lengths = conll03_data.get_batch_variable(data_train, batch_size)
12 optim.zero_grad()
---> 13 loss = network.loss(word, char, labels, mask=masks)
14 loss.backward()
15 optim.step()
~/NeuroNLP2/neuronlp2/models/sequence_labeling.py in loss(self, input_word, input_char, target, mask, length, hx)
291 def loss(self, input_word, input_char, target, mask=None, length=None, hx=None):
292 # output from rnn [batch, length, tag_space]
--> 293 output, _, mask, length = self._get_rnn_output(input_word, input_char, mask=mask, length=length, hx=hx)
294
295 if length is not None:
~/NeuroNLP2/neuronlp2/models/sequence_labeling.py in _get_rnn_output(self, input_word, input_char, mask, length, hx)
252
253 # [batch, length, char_length, char_dim]
--> 254 char = self.char_embedd(input_char)
255 char_size = char.size()
256 # first transform to [batch *length, char_length, char_dim]
/anaconda/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
222 for hook in self._forward_pre_hooks.values():
223 hook(self, input)
--> 224 result = self.forward(*input, **kwargs)
225 for hook in self._forward_hooks.values():
226 hook_result = hook(self, input, result)
~/NeuroNLP2/neuronlp2/nn/modules/sparse.py in forward(self, input)
68 if input.dim() > 2:
69 num_inputs = np.prod(input_size[:-1])
---> 70 input = input.view(num_inputs, input_size[-1])
71
72 output_size = input_size + (self.embedding_dim, )
/anaconda/lib/python3.6/site-packages/torch/autograd/variable.py in view(self, *sizes)
508
509 def view(self, *sizes):
--> 510 return View.apply(self, sizes)
511
512 def view_as(self, tensor):
/anaconda/lib/python3.6/site-packages/torch/autograd/_functions/tensor.py in forward(ctx, i, sizes)
94 ctx.new_sizes = sizes
95 ctx.old_size = i.size()
---> 96 result = i.view(*sizes)
97 ctx.mark_shared_storage((i, result))
98 return result
TypeError: view received an invalid combination of arguments - got (numpy.int64, int), but expected one of:
didn't match because some of the arguments have invalid types: (numpy.int64, int)
The text was updated successfully, but these errors were encountered: