aonotas / deep-crf

An implementation of Conditional Random Fields (CRFs) with Deep Learning Method
http://deep-crf.com
MIT License
167 stars 48 forks source link

ValueError: need more than 1 value to unpack #54

Open masakuri opened 6 years ago

masakuri commented 6 years ago

When I predicted with English test file, it worked. But when I predicted with Japanese test file (and set pre-trained Japanese word embeddings file), I got the following error.

  File "build/bdist.linux-x86_64/egg/deepcrf/__init__.py", line 119, in predict
  File "build/bdist.linux-x86_64/egg/deepcrf/main.py", line 149, in run
  File "build/bdist.linux-x86_64/egg/deepcrf/util.py", line 65, in load_vocab
ValueError: need more than 1 value to unpack

My command is like: deep-crf predict input_test_jp.txt --delimiter=" " --model_filename ./save_jpmodel_dir/bilstm-cnn-crf_adam_jp_epoch41.model --save_dir save_jpmodel_dir --save_name bilstm-cnn-crf_adam_jp --word_emb_file jp_word_emb300.txt --n_word_emb 300 --word_emb_vocab_type replace_only --predicted_output predicted41_jp.txt --gpu 0

Any ideas? Thank you.

aonotas commented 6 years ago

OK. please let me know following information

ls -lr ./save_jpmodel_dir/
head ./save_jpmodel_dir/bilstm-cnn-crf_adam_jp.vocab_char

Please tell me your .vocab_char file contains '\t' ?

aonotas commented 6 years ago

I just fix the code now. https://github.com/aonotas/deep-crf/commit/0fec504da3636230d4e8a9adf670e953cbbf527c

So please try recent version.

masakuri commented 6 years ago

It worked! Thank you very much.

aonotas commented 6 years ago

Thank you. I fix code again. please try to use recent version again. Maybe you char_file contains : CHAR \t CHAR \t Index.

masakuri commented 6 years ago

Recent version is also worked. Thank you very much. I checked my char_file (bilstm-cnn-crf_adam_jp.vocab_char) but I could not find CHAR[tab]CHAR [tab]Index.

masakuri commented 6 years ago

I found an following unusual example but I could not find CHAR[tab]CHAR[tab]Index ones. <U+0080>[tab]438 ~Maybe this is the cause.~ I don't know.