tensorflow / nmt

TensorFlow Neural Machine Translation Tutorial
Apache License 2.0
6.36k stars 1.96k forks source link

How to use the pretrained word representations (word2vec) ? #353

Open yapingzhao opened 6 years ago

yapingzhao commented 6 years ago

Hi, 1.How to use the pretrained word representations (word2vec) to initialize the embedding weights? 2.The embedding principle in nmt/tensorflow is CBOW or skip-gram? Looking forward to your advice or answers. If you have any suggestions, please give me some suggestions, thank you very much! Best regards, Thank you.

Lapis-Hong commented 6 years ago

set this option --embed_prefix to use your embedding file

yapingzhao commented 6 years ago

thank you very much!

yapingzhao commented 5 years ago

@Lapis-Hong Hi, I want to use the --embed_prefix option to use my own trained word vector (word2vec). But,An error occurred while I was running the command python -m nmt.nmt --src=vi --tgt=en --num_units=300 --embed_prefix=nmt/nmt_data/vector error: FailedPreconditionError (see above for traceback): HashTable has different value for same key. Key ᠤ has 23 and trying to add value 1518 [[Node: string_to_index/hash_table/table_init = InitializeTableFromTextFileV2[delimiter="\t", key_index=-2, value_index=-1, vocab_size=-1, _device="/job:localhost/replica:0/task:0/device:CPU:0"](string_to_index/hash_table, string_to_index/hash_table/table_init/asset_filepath)]]

If you have any suggestions, please give me some suggestions, thank you very much!