How to load pretrained word2vec embedding files with opennmt-tf?

Hi,

when I try to use the embedding files like below:

src_embedding: ../data/word2vec_vectors.en
tgt_embedding: ../data/word2vec_vectors.zh

Errors occurs:

Traceback (most recent call last):
  File "/anaconda3/lib/python3.6/site-packages/opennmt/inputters/text_inputter.py", line 355, in transform
    embeddings = tf.get_variable("w_embs", dtype=self.dtype, trainable=self.trainable)
  File "/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 1487, in get_variable
    aggregation=aggregation)
  File "/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 1237, in get_variable
    aggregation=aggregation)
  File "/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 540, in get_variable
    aggregation=aggregation)
  File "/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 492, in _true_getter
    aggregation=aggregation)
  File "/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/variable_scope.py", line 904, in _get_single_variable
    tf_inspect.getargspec(initializer).args)
ValueError: You can only pass an initializer function that expects no arguments to its callable when the shape is not fully defined. The given initializer function expects the following args ['self', 'shape', 'dtype', 'partition_info']

During handling of the above exception, another exception occurred:

Here is my question:
Maybe the word2vec embedding files can not be used directly, how to use the word2vec embedding ?

Thanks very much!

Hi,

  • What is your TensorFlow version?
  • What is your model configuration?
  • Is this error occurring during the initial training?