Translation error - No matching files for model !

1,002 views
Skip to first unread message

Riya Gupta

unread,
Jul 5, 2018, 6:19:39 AM7/5/18
to Nematus Support
I am receiving this error while translating the model.npz !
I cannot understand the error as model.npz is already present.

Any help will be appreciated.


 
2018-07-05 12:02:11.372548: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2018-07-05 12:02:17.330883: W tensorflow/core/framework/op_kernel.cc:1318] OP_REQUIRES failed at save_restore_tensor.cc:170 : Not found: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for /home/ahomef/b/basanta/nematus/models/model.npz
Process Process-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "nematus/translate.py", line 139, in _start_worker
    models = self._load_models(process_id, sess)
  File "nematus/translate.py", line 124, in _load_models
    model, saver = create_model(options, sess, ensemble_scope=scope)
  File "/home/ahomef/b/basanta/nematus/nematus/nmt.py", line 104, in create_model
    saver.restore(sess, os.path.abspath(reload_filename))
  File "/home/ahomef/b/basanta/nematus/env/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1802, in restore
    {self.saver_def.filename_tensor_name: save_path})
  File "/home/ahomef/b/basanta/nematus/env/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 900, in run
    run_metadata_ptr)
  File "/home/ahomef/b/basanta/nematus/env/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1135, in _run
    feed_dict_tensor, options, run_metadata)
  File "/home/ahomef/b/basanta/nematus/env/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1316, in _do_run
    run_metadata)
  File "/home/ahomef/b/basanta/nematus/env/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1335, in _do_call
    raise type(e)(node_def, op, message)
NotFoundError: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for /home/ahomef/b/basanta/nematus/models/model.npz
         [[Node: model0/save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_INT32], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_model0/save/Const_0_0, model0/save/RestoreV2/tensor_names, model0/save/RestoreV2/shape_and_slices)]]

Caused by op u'model0/save/RestoreV2', defined at:
  File "nematus/translate.py", line 363, in <module>
    main(input_file, output_file, translation_settings)
  File "nematus/translate.py", line 347, in main
    translator = Translator(translation_settings)
  File "nematus/translate.py", line 63, in __init__
    self._init_processes()
  File "nematus/translate.py", line 105, in _init_processes
    processes[process_id].start()
  File "/usr/lib/python2.7/multiprocessing/process.py", line 130, in start
    self._popen = Popen(self)
  File "/usr/lib/python2.7/multiprocessing/forking.py", line 126, in __init__
    code = process_obj._bootstrap()
  File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "nematus/translate.py", line 139, in _start_worker
    models = self._load_models(process_id, sess)
  File "nematus/translate.py", line 124, in _load_models
    model, saver = create_model(options, sess, ensemble_scope=scope)
  File "/home/ahomef/b/basanta/nematus/nematus/nmt.py", line 55, in create_model
    saver = tf.train.Saver(var_map, max_to_keep=None)
  File "/home/ahomef/b/basanta/nematus/env/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1338, in __init__
    self.build()
  File "/home/ahomef/b/basanta/nematus/env/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1347, in build
    self._build(self._filename, build_save=True, build_restore=True)
  File "/home/ahomef/b/basanta/nematus/env/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1384, in _build
    build_save=build_save, build_restore=build_restore)
  File "/home/ahomef/b/basanta/nematus/env/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 835, in _build_internal
    restore_sequentially, reshape)
  File "/home/ahomef/b/basanta/nematus/env/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 472, in _AddRestoreOps
    restore_sequentially)
  File "/home/ahomef/b/basanta/nematus/env/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 886, in bulk_restore
    return io_ops.restore_v2(filename_tensor, names, slices, dtypes)
  File "/home/ahomef/b/basanta/nematus/env/local/lib/python2.7/site-packages/tensorflow/python/ops/gen_io_ops.py", line 1463, in restore_v2
    shape_and_slices=shape_and_slices, dtypes=dtypes, name=name)
  File "/home/ahomef/b/basanta/nematus/env/local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "/home/ahomef/b/basanta/nematus/env/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op
    op_def=op_def)
  File "/home/ahomef/b/basanta/nematus/env/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1718, in __init__
    self._traceback = self._graph._extract_stack()  # pylint: disable=protected-access

NotFoundError (see above for traceback): Unsuccessful TensorSliceReader constructor: Failed to find any matching files for /home/ahomef/b/basanta/nematus/models/model.npz
         [[Node: model0/save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_INT32], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_model0/save/Const_0_0, model0/save/RestoreV2/tensor_names, model0/save/RestoreV2/shape_and_slices)]]




Rico Sennrich

unread,
Jul 6, 2018, 6:35:36 AM7/6/18
to nematus...@googlegroups.com
Hello Riya,

is it possible thata your model file exists, but is corrupted? I would suggest you try to delete the file and run training again, or remove the "--reload" flag from your command.

best wishes,
Rico
--
You received this message because you are subscribed to the Google Groups "Nematus Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nematus-suppo...@googlegroups.com.
To post to this group, send email to nematus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nematus-support/e0c41cc1-c0c5-47f6-aa05-588862d5fe4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Riya Gupta

unread,
Jul 6, 2018, 6:47:31 AM7/6/18
to Nematus Support
Dear Sir ,
Sorry for bothering too much.

I figured out the way , but what I observed was if I ran the training set for 1 epoch then it showed the error of no matching files.As soon as I increased the epoch number , it added the model.npz to the checkpoints path
I re ran the model the I received the following error , which I suppose is because of the fact of different number of vocab  present in my target and source dataset.Can you please clear up my doubt of how shall I overcome that error.
Please check my commands because I am encountering alot of errors.
training :
python nematus/nmt.py --source_dataset hi-en/bojar/train.tok.hi --target_dataset hi-en/bojar/train.tok.en --dictionaries hi-en/bojar/vocabbr.BPE.en.json hi-en/bojar/vocabbr.BPE.en.json --model models/model.npz --source_vocab_sizes 5863 --target_vocab_size 7576 --dim 512 --dim_word 256 --enc_depth 1 --dec_depth 1 --maxlen 100 --batch_size 50 --max_epochs 2 --learning_rate 0.0001 --valid_source_dataset hi-en/dev/dev.tok.hi --valid_target_dataset hi-en/dev/dev.tok.en --valid_batch_size 50

translation :

python nematus/translate.py -k 12 --models models/model.npz --input hi-en/dev/dev.tok.hi --output models/output 


Error I encountered while running translation file :

InvalidArgumentError (see above for traceback): indices[7,420] = 6948 is not in [0, 5863)
         [[Node: model0/encoder/embedding_1/embedding_lookup = GatherV2[Taxis=DT_INT32, Tindices=DT_INT32, Tparams=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](model0/encoder/embedding/embeddings/read, model0/encoder/embedding_1/strided_slice, model0/encoder/embedding_1/embedding_lookup/axis)]]

This is what I have received after clearing and retraining the model and on translation.

Regards,
Riya

Rico Sennrich

unread,
Jul 6, 2018, 7:20:07 AM7/6/18
to nematus...@googlegroups.com
Hello Riya,

check your model.npz.json file - it should have the same parameters (especially "--source_vocab_sizes") that you used for training. Maybe you have an old file left over from a previous training run.
Also, I noticed that you're using the English dictionary as your input vocabulary, which you may want to correct (but which shouldn't cause the error you see).

Riya Gupta

unread,
Jul 6, 2018, 7:23:38 AM7/6/18
to Nematus Support
Dear sir ,

Thank you for responding.

Best wishes,
Riya
Reply all
Reply to author
Forward
0 new messages