asiddhant / active-nlp Goto Github PK
View Code? Open in Web Editor NEWBayesian Deep Active Learning for Natural Language Processing Tasks
Bayesian Deep Active Learning for Natural Language Processing Tasks
@asiddhant Thanks for sharing the code. I wanted to ask if you can add a README file to the repo as it will help in understanding what each file does and the overall workflow as well.
Regards,
Saket
Looking at source code of MC models and https://github.com/asiddhant/Active-NLP/blob/master/active_learning/acquisition_cls.py#L102 . The default nn.DropOut
is not activated when in eval mode, so I don't understand how the model is an MC model as the dropout turns off when evaluating.
Hi - Can you list the required versions for the packages used (torch, scipy, etc)?
Thank you
How can i get this file?
wordvectors/glove.6B.100d.txt
Can you send it to me ?
thank you very much !
Hi,
I was able to get the code working, but I am not able to get the scores from the decoder when I run the model on an unlabeled dataset (I get the scores during training stage). Can you please suggest if there is anything that I am missing.
Thanks,
Prateek
Hi,
When I run CNN_CNN_LSTM I get matrix mismatch error. Was wondering if you could have any pointers?
Traceback (most recent call last):
File "/home/prateek.verma/remote_ner/active_ner.py", line 318, in
eval_test_train=False, plot_every = acq_plot_every, lr_decay = 0.05)
File "/home/prateek.verma/remote_ner/neural_ner/util/trainer.py", line 76, in train_model
score = self.model(words, tags, chars, caps, wordslen, charslen, mask, n_batches)
File "/opt/conda/envs/py27/lib/python2.7/site-packages/torch/nn/modules/module.py", line 532, in call
result = self.forward(*input, **kwargs)
File "/home/prateek.verma/remote_ner/neural_ner/models/cnn_cnn_lstm.py", line 72, in forward
loss = self.decoder(new_word_features, tags, tagsmask, usecuda=usecuda)
File "/opt/conda/envs/py27/lib/python2.7/site-packages/torch/nn/modules/module.py", line 532, in call
result = self.forward(*input, **kwargs)
File "/home/prateek.verma/remote_ner/neural_ner/modules/DecoderRNN.py", line 66, in forward
usecuda=usecuda)
File "/home/prateek.verma/remote_ner/neural_ner/modules/DecoderRNN.py", line 41, in forward_step
output = self.linear(output.squeeze(0))
File "/opt/conda/envs/py27/lib/python2.7/site-packages/torch/nn/modules/module.py", line 532, in call
result = self.forward(*input, **kwargs)
File "/opt/conda/envs/py27/lib/python2.7/site-packages/torch/nn/modules/linear.py", line 87, in forward
return F.linear(input, self.weight, self.bias)
File "/opt/conda/envs/py27/lib/python2.7/site-packages/torch/nn/functional.py", line 1370, in linear
ret = torch.addmm(bias, input, weight.t())
RuntimeError: size mismatch, m1: [2 x 50], m2: [350 x 19] at /opt/conda/conda-bld/pytorch_1579022021485/work/aten/src/THC/generic/THCTensorMathBlas.cu:290
The sort_info you got from create_batches is the indexes of the current postions after sorted from original order which means that origin_data[sort_info] equals to sorted_data. However, after you doing some operations of prediction, you wanna recovering to the original order, you did sorted_data[sort_info], it is totally wrong and makes the acquisition functions not work. The true operation is to sort the sort_info to get the inverse index, for example, sort_info = [2, 0, 1], you shoud make a list of tuples like [(0,2), (1, 0), (2, 1)], the second value in each tuple is your sort_info, and the first value is the index of sort_info. And then, you sort the list of tuples by the second value, you would get [(1, 0), (2, 1) ,(0, 2)]. Finally, [1, 2, 0] would be the inverse index that can recover the sorted_data to origin_data by "sorted_data[inv_sort_info]".
this line have error ,how to fix it, thanks! packed_rnn_input = torch.nn.utils.rnn.pack_padded_sequence(rnn_input, input_lengths,batch_first=False)
builtins.RuntimeError: dimension out of range (expected to be in range of [-1, 0], but got 1)
decoder_output, last_hidden, decoder_attention = decoder(di,decoder_input, last_hidden, encoder_outputs,input_lengths=lengths_sorted)
File "D:\ProgramData\Anaconda3\Lib\site-packages\torch\nn\modules\module.py", line 491, in call
result = self.forward(*input, **kwargs)
 File "D:\change\chunking\models\seq2seq\scripts\model.py", line 205, in forward
packed_rnn_input = torch.nn.utils.rnn.pack_padded_sequence(rnn_input, input_lengths,batch_first=False)
File "D:\ProgramData\Anaconda3\Lib\site-packages\torch\onnx_init_.py", line 57, in wrapper
return fn(*args, **kwargs)
File "D:\ProgramData\Anaconda3\Lib\site-packages\torch\nn\utils\rnn.py", line 124, in pack_padded_sequence
data, batch_sizes = PackPadded.apply(input, lengths, batch_first)
File "D:\ProgramData\Anaconda3\Lib\site-packages\torch\nn_functions\packing.py", line 31, in forward
steps.append(input[prev_l:l, :c_batch_size].contiguous().view(-1, *input.size()[2:]))
builtins.RuntimeError: dimension out of range (expected to be in range of [-1, 0], but got 1)
Traceback (most recent call last):
File "active_ner.py", line 313, in
eval_test_train=False, plot_every = acq_plot_every, lr_decay = 0.05)
File "F:\git\Active-NLP\neural_ner\util\trainer.py", line 77, in train_model
score = self.model(words, tags, chars, caps, wordslen, charslen, mask, n_batches, usecuda=True)
File "E:\Program Files\Python3.6\lib\site-packages\torch\nn\modules\module.py", line 491, in call
result = self.forward(*input, **kwargs)
TypeError: forward() got multiple values for argument 'usecuda'
why this error?when i run it
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.