Comments (5)
Hi achernodub, i think you mean word-level. I've completed a draft (seq_w.py
), and pushed to a new branch seq_w
. Since I am quite busy recently, I havnt tested it, and it could have some bugs. You are welcome to try it and make a pull request if you find bugs & fix them :-). Also, if you find it to be bug-free, feel free to let us know and close this issue :-)
from lm-lstm-crf.
Hi @LiyuanLucasLiu !
You are doing a great product! Thank you a lot for a quick answer despite you are very busy, I very appreciate it.
- I've tested seq_w.py on my side and it seems not to work properly. The main problem is that for the trained and stored model it produces different outputs (i.e. output txt files) for different launches. I did this:
python seq_w.py --load_arg exp/am_cwlm_lstm_crf.json --load_check_point exp/am_cwlm_lstm_crf.model --input_file exp/test_raw.txt --output_file output.txt --decode_type label
The results in output.txt are very different for different runs for the same input file! This is the biggest problem, I kindly ask you to fix it, if possible.
- When I run:
python eval_w.py --load_arg exp/am_cwlm_lstm_crf.json --load_check_point exp/am_cwlm_lstm_crf.model --gpu 0 --dev_file exp/dev.txt --test_file exp/test.txt
it shows an error:
Traceback (most recent call last):
File "eval_w.py", line 93, in <module>
print(jd['checkpoint'] + ' dev_f1: %.4f dev_rec: %.4f dev_pre: %.4f dev_acc: %.4f test_f1: %.4f test_rec: %.4f test_pre: %.4f test_acc: %.4f\n' % (dev_f1, dev_rec, dev_pre, dev_acc, test_f1, test_rec, test_pre, test_acc))
KeyError: 'checkpoint'
if I comment jd['checkpoint']
, i.e. making the code in the end of file:
print(' dev_f1: %.4f dev_rec: %.4f dev_pre: %.4f dev_acc: %.4f test_f1: %.4f test_rec: %.4f test_pre: %.4f test_acc: %.4f\n' % (dev_f1, dev_rec, dev_pre, dev_acc, test_f1, test_rec, test_pre, test_acc))
else:
dev_acc = evaluator.calc_score(ner_model, dev_dataset_loader)
test_acc = evaluator.calc_score(ner_model, test_dataset_loader)
print(' dev_acc: %.4f test_acc: %.4f\n' % (dev_acc, test_acc))
But I get the same f1/accuracy results for different runs of eval_w.py
!
a@aa:~/LM-LSTM-CRF ((HEAD detached at origin/seq_w))$ python eval_w.py --load_arg exp/am_cwlm_lstm_crf.json --load_check_point exp/am_cwlm_lstm_crf.model --gpu 0 --dev_file exp/dev.txt --test_file exp/test.txt
dev_f1: 0.3434 dev_rec: 0.3827 dev_pre: 0.3114 dev_acc: 0.5059 test_f1: 0.2709 test_rec: 0.2489 test_pre: 0.2971 test_acc: 0.4350
a@aa:~/LM-LSTM-CRF ((HEAD detached at origin/seq_w))$ python eval_w.py --load_arg exp/am_cwlm_lstm_crf.json --load_check_point exp/am_cwlm_lstm_crf.model --gpu 0 --dev_file exp/dev.txt --test_file exp/test.txt
dev_f1: 0.3434 dev_rec: 0.3827 dev_pre: 0.3114 dev_acc: 0.5059 test_f1: 0.2709 test_rec: 0.2489 test_pre: 0.2971 test_acc: 0.4350
a@aa:~/LM-LSTM-CRF ((HEAD detached at origin/seq_w))$ python eval_w.py --load_arg exp/am_cwlm_lstm_crf.json --load_check_point exp/am_cwlm_lstm_crf.model --gpu 0 --dev_file exp/dev.txt --test_file exp/test.txt
dev_f1: 0.3434 dev_rec: 0.3827 dev_pre: 0.3114 dev_acc: 0.5059 test_f1: 0.2709 test_rec: 0.2489 test_pre: 0.2971 test_acc: 0.4350
= the same for 3 runs that is with contradiction with (1), where outputs are different.
Please, help!
from lm-lstm-crf.
Thanks a lot! nice to hear you like our project!
I just checked the code, this is caused by a bug. As to predictor, I forgot to set ner_model
to eval
mode, which means the dropout
is still applied during annotation, which causes unstable.
I added some code, which should fix this bug (but i havt tried it myself... ).
It would be really helpful if you can test it for us :-)
from lm-lstm-crf.
@LiyuanLucasLiu yes, you really fixed it, I tested it, now it works properly. Thank you a lot! I recently prepared my own version of seq_w.py based on eval_w.py and it also worked good, now it became clear, why. Yes, the reason with dropout sounds funny! )) BTW, did you think about a variational dropout, where you freeze a neuron of RNN for the whole sequence (instead of choosing the random neuron for each time step)? https://arxiv.org/pdf/1707.09861.pdf reports the considerable increase of quality for seq-2-seq tasks, and it is intuitively clear, why this happens.
from lm-lstm-crf.
Thanks for letting me know. Yes, i've considered to use the variational dropout, or other kinds of dropout (like https://arxiv.org/abs/1609.08017), but i havnt tried them. Thanks for the comments, and i would tried these ideas when i have time. Also if you want to try these trickes by yourself, i'm willing to paticipate some collaboration :-)
from lm-lstm-crf.
Related Issues (20)
- train_w.py Error HOT 2
- Mismatch of performance between this repository and the paper HOT 6
- How can I include handcrafted features in NER ?
- evaluator.calc_score HOT 3
- where is the dictory './data'
- AttributeError: module 'torch._C' has no attribute '_cuda_setDevice' HOT 3
- KeyError in predictor.py class predict HOT 1
- Question about POS performance HOT 2
- How to deal with sentences with different lengths?
- train_w.py Error, TypeError: can't convert np.ndarray of type numpy.object_ HOT 2
- Is word level bi-lstm reflected in the code ? HOT 1
- About the score given a sequence and a target
- anyone can update to pytorch1.0
- Missing "eval_batch" in train_w.py line 163 HOT 1
- RuntimeError: HOT 1
- dropout
- RuntimeError: expand(torch.LongTensor{[50, 1]}, size=[50]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2)
- How do you tune the model to get a large # of keywords outputted by the CRF layer? HOT 1
- Incorrect Precision Output for test_rec HOT 1
- Line 530 in utils.py is too slow with huge datasets HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lm-lstm-crf.