aonotas / deep-crf

An implementation of Conditional Random Fields (CRFs) with Deep Learning Method

Home Page:http://deep-crf.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValueError: need more than 0 values to unpack

binhna opened this issue · comments

image
I got this issue and have no idea to resolve. I need your help.

Hi @binhna,

Thank you for your report.
Could you tell me your command?

I think you didn't set --dev_file argument?

I have modified README.md to set --dev_file input_file_dev.txt.

Please let me know if you have some problems.

Thank you very much. But I still have a problem when predicting:

Binhs-MacBook-Pro:deep-crf BinhNguyen$ deep-crf predict input_raw_file.txt --model_name bilstm-cnn-crf --model_filename /Users/BinhNguyen/Downloads/deep-crf/save_model_dir/bilstm-cnn-crf_adam_epoch26.model --predicted_output predicted.txt
{'dropout_rate': 0.33, 'vocab_file': None, 'n_char_hidden': 30, 'batchsize': 32, 'model_filename': '/Users/BinhNguyen/Downloads/deep-crf/save_model_dir/bilstm-cnn-crf_adam_epoch26.model', 'use_crf': 1, 'vocab_char_file': None, 'weight_decay': 0.0, 'optimizer': u'adam', 'n_hidden': 200, 'efficient_gpu': 1, 'init_lr': 0.001, 'use_lr_decay': 0, 'use_cudnn': 1, 'n_word_emb': 100, 'predicted_output': u'predicted.txt', 'gpu': -1, 'save_name': u'', 'test_file': None, 'word_emb_file': None, 'max_iter': 50, 'n_layer': 1, 'dev_file': None, 'word_emb_vocab_type': u'replace_all', 'n_vocab_min_cnt': 0, 'input_idx': u'0', 'output_idx': u'-1', 'delimiter': u'\t', 'n_char_emb': 30, 'save_dir': u'save_model_dir', 'n_add_feature_emb': 100, 'model_name': u'bilstm-cnn-crf'}
[2017-09-21 08:12:38,640] [INFO] train:2388 (run@main.py:230)
[2017-09-21 08:12:38,640] [INFO] dev  :0 (run@main.py:231)
[2017-09-21 08:12:38,640] [INFO] test :0 (run@main.py:232)
[2017-09-21 08:12:38,640] [INFO] vocab     :17496 (run@main.py:233)
[2017-09-21 08:12:38,640] [INFO] vocab_tags:9 (run@main.py:234)
[2017-09-21 08:12:38,640] [INFO] unk count (train):4566 (run@main.py:235)
[2017-09-21 08:12:38,641] [INFO] unk rate  (train):0.0686203787196 (run@main.py:236)
[2017-09-21 08:12:38,641] [INFO] cnt all words (train):66540 (run@main.py:237)
[2017-09-21 08:12:38,641] [INFO] unk count (dev):0 (run@main.py:238)
[2017-09-21 08:12:38,641] [INFO] unk rate  (dev):0.0 (run@main.py:239)
[2017-09-21 08:12:38,641] [INFO] cnt all words (dev):0 (run@main.py:240)
[2017-09-21 08:12:38,641] [INFO] ###################### (run@main.py:242)
[2017-09-21 08:12:38,641] [INFO] ## Model Config (run@main.py:243)
[2017-09-21 08:12:38,641] [INFO] model_name:bilstm-cnn-crf (run@main.py:244)
[2017-09-21 08:12:38,641] [INFO] batchsize:32 (run@main.py:245)
[2017-09-21 08:12:38,641] [INFO] optimizer:adam (run@main.py:246)
[2017-09-21 08:12:38,641] [INFO] ###################### (run@main.py:248)
[2017-09-21 08:12:38,641] [INFO] ## Model Save Config (run@main.py:249)
[2017-09-21 08:12:38,641] [INFO] save_dir :save_model_dir/ (run@main.py:250)
[2017-09-21 08:12:38,641] [INFO] save_vocab        :save_model_dir/bilstm-cnn-crf_adam.vocab (run@main.py:253)
[2017-09-21 08:12:38,642] [INFO] save_vocab_char   :save_model_dir/bilstm-cnn-crf_adam.vocab_char (run@main.py:254)
[2017-09-21 08:12:38,642] [INFO] save_tags_vocab   :save_model_dir/bilstm-cnn-crf_adam.vocab_tag (run@main.py:255)
[2017-09-21 08:12:38,642] [INFO] save_train_config :save_model_dir/bilstm-cnn-crf_adam.train_config (run@main.py:256)
Traceback (most recent call last):
  File "/usr/local/bin/deep-crf", line 11, in <module>
    load_entry_point('DeepCRF==1.0', 'console_scripts', 'deep-crf')()
  File "/Library/Python/2.7/site-packages/click-6.7-py2.7.egg/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/click-6.7-py2.7.egg/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Library/Python/2.7/site-packages/click-6.7-py2.7.egg/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Python/2.7/site-packages/click-6.7-py2.7.egg/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Python/2.7/site-packages/click-6.7-py2.7.egg/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "build/bdist.macosx-10.12-intel/egg/deepcrf/__init__.py", line 112, in predict
  File "build/bdist.macosx-10.12-intel/egg/deepcrf/main.py", line 367, in run
UnboundLocalError: local variable 'predict_dev_tags' referenced before assignment

image

Hi @binhna
I'm sorry for that bug.
I have modified that bug few days ago.

So can you update the deep-crf with following commands?

cd deep-crf
git pull
python setup.py install

Thats great! But a bug when evaluate!
image

Thank you for your report and I'm sorry for that bug.
Can you show me your gold.txt and predicted.txt?

head -n 20 gold.txt
head -n 20 predicted.txt

I think that the line of your file is difference?
please tell me your number of line in gold and predicted.

wc -l gold.txt
wc -l predicted.txt

I can send to you via email, is it ok?

OK.
nanigashi03@gmail.com

Please send it to me when you have time.

sent! Please check for me. Thank you

Thank you.
I checked your gold file.

Around line 29 - 65, it seems wrong sentence between gold.txt and predicted.txt .
Please check your input_raw_file.txt whether input_raw_file.txt and gold.txt have same sentence order?

can you tell me ?

head -n 5 input_raw_file.txt

I think input_raw_file.txt should contains words number.

line 1: 28 words
line 2: 35 words
line 3: 31 words

I'm sorry for the inconvenience. It's my fault, exactly what you say. The input_raw_file.txt is incorrect. I fixed and it worked now.
Thank you very much.

OK!
If you have other questions, please let me know!