nouhadziri/THRED

Model Directory while Testing

Closed this issue · 1 comments

While testing, the model requires a copy of the model_dir to also be present in the same directory as it was at the time of training the model.
If the model_dir has been moved or renamed, an error is thrown.
The moved model directory passed in the argument --model_dir <model_dir> while testing is used to store the outputs.

``Traceback (most recent call last):
  File "main.py", line 51, in <module>
    tf.app.run()
  File "/home/ydz853/.conda/envs/env_py35/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "main.py", line 47, in main
    model.test()
  File "/home/ydz853/papyrus/THRED/models/vanilla/vanilla_wrapper.py", line 527, in test
    ckpt = tf.train.latest_checkpoint(self.config.get_infer_model_dir())
  File "/home/ydz853/.conda/envs/env_py35/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 1722, in latest_checkpoint
    if file_io.get_matching_files(v2_path) or file_io.get_matching_files(
  File "/home/ydz853/.conda/envs/env_py35/lib/python3.5/site-packages/tensorflow/python/lib/io/file_io.py", line 333, in get_matching_files
    for single_filename in filename
  File "/home/ydz853/.conda/envs/env_py35/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 473, in __exit__
    c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.NotFoundError: /home/ydz853/model_dir_vanilla_large/best_dev_ppl; No such file or directory
ehsk commented

In the model directory, there is a yaml config file where the model parameters are stored. The config file also contains several file paths including the dataset files, the vocabulary files, the best model, checkpoints, and etc. I think updating these paths would resolve the issue for now. In the next version, we will make all paths relative to the model directory to avoid such issues.