lajanugen / S2V

ICLR 2018 Quick-Thought vectors
https://arxiv.org/pdf/1803.02893.pdf
Apache License 2.0
205 stars 64 forks source link

Cannot load ckpt model file #11

Open deepankar27 opened 5 years ago

deepankar27 commented 5 years ago

Trained the model using the existing code but when trying to load the model using Skip-thought code:

encoder.load_model(configuration.model_config(bidirectional_encoder=False),
                   vocabulary_file=VOCAB_FILE,
                   embedding_matrix_file=EMBEDDING_MATRIX_FILE,
                   checkpoint_path=CHECKPOINT_PATH)

It's throwing me exception:

NotFoundError (see above for traceback): Restoring from checkpoint failed. This is most likely due to a Variable name or other graph key that is missing from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error:


NFO:tensorflow:Reading vocabulary from C:\Users\DATA_DIR\QTV\Ver_1\exp_vocab\word_embedding.txt INFO:tensorflow:Loaded vocabulary with 929088 words. INFO:tensorflow:Loading embedding matrix from C:\Users\DATA_DIR\QTV\Ver_1\exp_vocab\word_embedding.npy INFO:tensorflow:Loaded embedding matrix with shape (929088, 300) INFO:tensorflow:Building model. INFO:tensorflow:Loading model from checkpoint: C:\Users\DATA_DIR\QTV\Ver_1\train_dir\model.ckpt-10000 INFO:tensorflow:Restoring parameters from C:\Users\DATA_DIR\QTV\Ver_1\train_dir\model.ckpt-10000


NotFoundError Traceback (most recent call last) ~\AppData\Local\Continuum\anaconda3\envs\skipthoughtenv\lib\site-packages\tensorflow\python\client\session.py in _do_call(self, fn, args) 1333 try: -> 1334 return fn(args) 1335 except errors.OpError as e:

~\AppData\Local\Continuum\anaconda3\envs\skipthoughtenv\lib\site-packages\tensorflow\python\client\session.py in _run_fn(feed_dict, fetch_list, target_list, options, run_metadata) 1318 return self._call_tf_sessionrun( -> 1319 options, feed_dict, fetch_list, target_list, run_metadata) 1320

~\AppData\Local\Continuum\anaconda3\envs\skipthoughtenv\lib\site-packages\tensorflow\python\client\session.py in _call_tf_sessionrun(self, options, feed_dict, fetch_list, target_list, run_metadata) 1406 self._session, options, feed_dict, fetch_list, target_list, -> 1407 run_metadata) 1408

NotFoundError: Key encoder/gru_cell/candidate/layer_norm/u/beta not found in checkpoint [[{{node save/RestoreV2}} = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_INT64], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]

During handling of the above exception, another exception occurred:

Any hint would be appreciable...

deepankar27 commented 5 years ago

@lajanugen I have able to create the model but now I cannot load it using :

encoder.load_model(configuration.model_config(modl), vocabulary_file=VOCAB_FILE, embedding_matrix_file=EMBEDDING_MATRIX_FILE, checkpoint_path=CHECKPOINT_PATH)

Where modl contain the eval json, I am quite clueless and looking for your inputs.