google / seq2seq

A general-purpose encoder-decoder framework for Tensorflow
https://google.github.io/seq2seq/
Apache License 2.0
5.6k stars 1.3k forks source link

Run python -m unittest seq2seq.test.pipeline_test on win7 #295

Open fanjingwei opened 7 years ago

fanjingwei commented 7 years ago

when i run python -m unittest seq2seq.test.pipeline_test on win7 after 1 step,there is an "Permission denied" error, is the "ResourceWarning: unclosed file <_io.BufferedRandom name=6>" warning case this error? 2017-08-31 22:07:39.700066: W C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\35\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow li brary wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. INFO:tensorflow:Saving checkpoints for 1 into C:\Users\ADMINI~1\AppData\Local\Temp\tmpl_zx4mgr\model.ckpt. INFO:tensorflow:Prediction followed by Target @ Step 1

SEQUENCE_END a a a 泣 c c c c SEQUENCE_END

c c c c c 泣 泣 泣 泣 SEQUENCE_END

====================================================================================================

INFO:tensorflow:loss = 1.94618, step = 1 INFO:tensorflow:Performing full trace on next step. INFO:tensorflow:Captured full trace at step 11 INFO:tensorflow:Saved run_metadata to C:\Users\ADMINI~1\AppData\Local\Temp\tmpl_zx4mgr\run_meta INFO:tensorflow:Saved timeline to C:\Users\ADMINI~1\AppData\Local\Temp\tmpl_zx4mgr\timeline.json WARNING:tensorflow:From E:\git\seq2seq\seq2seq\training\hooks.py:133: write_op_log (from tensorflow.contrib.tfprof.tfprof_logger) is deprecated and wi ll be removed after 2018-01-01. Instructions for updating: Use tf.profiler.write_op_log. go/tfprof INFO:tensorflow:Saved op log to C:\Users\ADMINI~1\AppData\Local\Temp\tmpl_zx4mgr INFO:tensorflow:Saving checkpoints for 50 into C:\Users\ADMINI~1\AppData\Local\Temp\tmpl_zx4mgr\model.ckpt. INFO:tensorflow:Loss for final step: 1.93593. INFO:tensorflow:Evaluating model now. INFO:tensorflow:Creating AttentionSeq2Seq in mode=eval INFO:tensorflow: AttentionSeq2Seq: attention.class: AttentionLayerBahdanau attention.params: {num_units: 10} bridge.class: seq2seq.models.bridges.ZeroBridge bridge.params: {} decoder.class: seq2seq.decoders.AttentionDecoder decoder.params: rnn_cell: cell_class: GRUCell cell_params: {num_units: 8} embedding.dim: 10 embedding.init_scale: 0.04 embedding.share: false encoder.class: seq2seq.encoders.BidirectionalRNNEncoder encoder.params: rnn_cell: cell_class: GRUCell cell_params: {num_units: 8} inference.beam_search.beam_width: 0 inference.beam_search.choose_successors_fn: choose_top_k inference.beam_search.length_penalty_weight: 0.0 optimizer.clip_embed_gradients: 0.1 optimizer.clip_gradients: 5.0 optimizer.learning_rate: 0.0001 optimizer.lr_decay_rate: 0.99 optimizer.lr_decay_steps: 100 optimizer.lr_decay_type: '' optimizer.lr_min_learning_rate: 1.0e-12 optimizer.lr_staircase: false optimizer.lr_start_decay_at: 0 optimizer.lr_stop_decay_at: 2147483647 optimizer.name: Adam optimizer.params: {} optimizer.sync_replicas: 0 optimizer.sync_replicas_to_aggregate: 0 source.max_seq_len: 50 source.reverse: true target.max_seq_len: 50 vocab_source: C:\Users\ADMINI~1\AppData\Local\Temp\tmpx283xxm9 vocab_target: C:\Users\ADMINI~1\AppData\Local\Temp\tmpyhe62_cm

INFO:tensorflow:Creating vocabulary lookup table of size 7 INFO:tensorflow:Creating vocabulary lookup table of size 7 INFO:tensorflow:Creating BidirectionalRNNEncoder in mode=eval INFO:tensorflow: BidirectionalRNNEncoder: init_scale: 0.04 rnn_cell: cell_class: GRUCell cell_params: {num_units: 8} dropout_input_keep_prob: 1.0 dropout_output_keep_prob: 1.0 num_layers: 1 residual_combiner: add residual_connections: false residual_dense: false

INFO:tensorflow:Creating AttentionLayerBahdanau in mode=eval INFO:tensorflow: AttentionLayerBahdanau: {num_units: 10}

INFO:tensorflow:Creating AttentionDecoder in mode=eval INFO:tensorflow: AttentionDecoder: init_scale: 0.04 max_decode_length: 100 rnn_cell: cell_class: GRUCell cell_params: {num_units: 8} dropout_input_keep_prob: 1.0 dropout_output_keep_prob: 1.0 num_layers: 1 residual_combiner: add residual_connections: false residual_dense: false

INFO:tensorflow:Creating ZeroBridge in mode=eval INFO:tensorflow: ZeroBridge: {}

INFO:tensorflow:Starting evaluation at 2017-08-31-14:09:07 INFO:tensorflow:Restoring parameters from C:\Users\ADMINI~1\AppData\Local\Temp\tmpl_zx4mgr\model.ckpt-50 2017-08-31 22:09:09.336193: W C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\35\tensorflow\core\kernels\queue_base.cc:303] _25_dev_input_fn/paralle l_read_1/common_queue: Skipping cancelled dequeue attempt with queue not closed sys:1: ResourceWarning: unclosed file <_io.BufferedRandom name=9> sys:1: ResourceWarning: unclosed file <_io.BufferedRandom name=10> 2017-08-31 22:09:11.446314: W C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\35\tensorflow\core\framework\op_kernel.cc:1192] Unknown: PermissionErr or: [Errno 13] Permission denied: 'C:\Users\ADMINI~1\AppData\Local\Temp\tmpaq6c50c1' EC:\Program Files\Anaconda3\lib\unittest\case.py:628: ResourceWarning: unclosed file <_io.BufferedRandom name=3> outcome.errors.clear() C:\Program Files\Anaconda3\lib\unittest\case.py:628: ResourceWarning: unclosed file <_io.BufferedRandom name=4> outcome.errors.clear() C:\Program Files\Anaconda3\lib\unittest\case.py:628: ResourceWarning: unclosed file <_io.BufferedRandom name=5> outcome.errors.clear() C:\Program Files\Anaconda3\lib\unittest\case.py:628: ResourceWarning: unclosed file <_io.BufferedRandom name=6> outcome.errors.clear() C:\Program Files\Anaconda3\lib\unittest\case.py:628: ResourceWarning: unclosed file <_io.BufferedRandom name=7> outcome.errors.clear() C:\Program Files\Anaconda3\lib\unittest\case.py:628: ResourceWarning: unclosed file <_io.BufferedRandom name=8> outcome.errors.clear()

====================================================================== ERROR: test_train_infer (seq2seq.test.pipeline_test.PipelineTest) Tests training and inference scripts.

Traceback (most recent call last): File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1327, in _do_call return fn(*args) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1306, in _run_fn status, run_metadata) File "C:\Program Files\Anaconda3\lib\contextlib.py", line 66, in exit next(self.gen) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 466, in raise_exception_on_not_ok_status pywrap_tensorflow.TF_GetCode(status)) tensorflow.python.framework.errors_impl.UnknownError: PermissionError: [Errno 13] Permission denied: 'C:\Users\ADMINI~1\AppData\Local\Temp\tmpaq 6c50c1' [[Node: bleu/value = PyFunc[Tin=[DT_STRING, DT_STRING], Tout=[DT_FLOAT], token="pyfunc_0", _device="/job:localhost/replica:0/task:0/cpu:0"](b leu/Identity, bleu/Identity_1)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "E:\git\seq2seq\seq2seq\test\pipeline_test.py", line 148, in test_train_infer train_script.main([]) File "E:\git\seq2seq\bin\train.py", line 272, in main schedule=FLAGS.schedule) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\learn_runner.py", line 209, in run return _execute_schedule(experiment, schedule) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\learn_runner.py", line 46, in _execute_schedule return task() File "E:\git\seq2seq\seq2seq\contrib\experiment.py", line 112, in continuous_train_and_eval hooks=self._eval_hooks) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\util\deprecation.py", line 296, in new_func return func(*args, kwargs) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\estimators\estimator.py", line 546, in evaluate log_progress=log_progress) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\estimators\estimator.py", line 858, in _evaluate_model config=self._session_config) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\training\evaluation.py", line 182, in _evaluate_once session.run(eval_ops, feed_dict) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\training\monitored_session.py", line 518, in run run_metadata=run_metadata) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\training\monitored_session.py", line 862, in run run_metadata=run_metadata) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\training\monitored_session.py", line 818, in run return self._sess.run(*args, *kwargs) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\training\monitored_session.py", line 972, in run run_metadata=run_metadata) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\training\monitored_session.py", line 818, in run return self._sess.run(args, kwargs) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 895, in run run_metadata_ptr) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1124, in _run feed_dict_tensor, options, run_metadata) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1321, in _do_run options, run_metadata) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1340, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.UnknownError: PermissionError: [Errno 13] Permission denied: 'C:\Users\ADMINI~1\AppData\Local\Temp\tmpaq 6c50c1' [[Node: bleu/value = PyFunc[Tin=[DT_STRING, DT_STRING], Tout=[DT_FLOAT], token="pyfunc_0", _device="/job:localhost/replica:0/task:0/cpu:0"](b leu/Identity, bleu/Identity_1)]]

Caused by op 'bleu/value', defined at: File "C:\Program Files\Anaconda3\lib\runpy.py", line 184, in _run_module_as_main "main", mod_spec) File "C:\Program Files\Anaconda3\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Program Files\Anaconda3\lib\unittest__main.py", line 18, in main(module=None) File "C:\Program Files\Anaconda3\lib\unittest\main.py", line 94, in init self.runTests() File "C:\Program Files\Anaconda3\lib\unittest\main.py", line 255, in runTests self.result = testRunner.run(self.test) File "C:\Program Files\Anaconda3\lib\unittest\runner.py", line 176, in run test(result) File "C:\Program Files\Anaconda3\lib\unittest\suite.py", line 84, in call return self.run(*args, **kwds) File "C:\Program Files\Anaconda3\lib\unittest\suite.py", line 122, in run test(result) File "C:\Program Files\Anaconda3\lib\unittest\suite.py", line 84, in call return self.run(*args, **kwds) File "C:\Program Files\Anaconda3\lib\unittest\suite.py", line 122, in run test(result) File "C:\Program Files\Anaconda3\lib\unittest\suite.py", line 84, in call return self.run(*args, **kwds) File "C:\Program Files\Anaconda3\lib\unittest\suite.py", line 122, in run test(result) File "C:\Program Files\Anaconda3\lib\unittest\case.py", line 648, in call return self.run(*args, *kwds) File "C:\Program Files\Anaconda3\lib\unittest\case.py", line 600, in run testMethod() File "E:\git\seq2seq\seq2seq\test\pipeline_test.py", line 148, in test_train_infer train_script.main([]) File "E:\git\seq2seq\bin\train.py", line 272, in main schedule=FLAGS.schedule) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\learn_runner.py", line 209, in run return _execute_schedule(experiment, schedule) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\learn_runner.py", line 46, in _execute_schedule return task() File "E:\git\seq2seq\seq2seq\contrib\experiment.py", line 112, in continuous_train_and_eval hooks=self._eval_hooks) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\util\deprecation.py", line 296, in new_func return func(args, **kwargs) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\estimators\estimator.py", line 546, in evaluate log_progress=log_progress) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\estimators\estimator.py", line 832, in _evaluate_model model_fn_results = self._get_eval_ops(features, labels, metrics) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\estimators\estimator.py", line 1199, in _get_eval_ops metrics, features, labels, model_fn_ops.predictions)) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\estimators\estimator.py", line 271, in _make_metrics_ops result[name] = metric.create_metric_ops(features, labels, predictions) File "E:\git\seq2seq\seq2seq\metrics\metric_specs.py", line 124, in create_metric_ops name="value") File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\ops\script_ops.py", line 203, in py_func input=inp, token=token, Tout=Tout, name=name) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\ops\gen_script_ops.py", line 36, in _py_func name=name) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 767, in apply_op op_def=op_def) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 2630, in create_op original_op=self._default_original_op, op_def=op_def) File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 1204, in init__ self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

UnknownError (see above for traceback): PermissionError: [Errno 13] Permission denied: 'C:\Users\ADMINI~1\AppData\Local\Temp\tmpaq6c50c1' [[Node: bleu/value = PyFunc[Tin=[DT_STRING, DT_STRING], Tout=[DT_FLOAT], token="pyfunc_0", _device="/job:localhost/replica:0/task:0/cpu:0"](b leu/Identity, bleu/Identity_1)]]


Ran 2 tests in 114.668s

FAILED (errors=1)

harishdamera commented 7 years ago

I got similar issue. May I know how did you solved this?

fanjingwei commented 7 years ago

I still did not solved this, and i find the same error on linux too

FutureShaper commented 7 years ago

Same issue on Windows 10.

brucebismarck commented 7 years ago

Same on windows 10

jerryff commented 6 years ago

same in win10

woonsangcho commented 6 years ago

same issue in win 10

gigibang commented 6 years ago

same issue in win 7

neerajks commented 6 years ago

Has anybody faced been able to get around this error.

morenoh149 commented 6 years ago

looks like a permission issue. looks like a resource was not released before another process tried to access it. Look into what the resource is and why it's not being released.

vicdxxx commented 6 years ago

do this kind of change can bypass it in bleu.py:

with open(hypothesis_file.name, "r") as read_pred:

with open("F:/Datasets/NLP/test.txt", "r") as read_pred:

  bleu_out = subprocess.check_output(
      bleu_cmd, stdin=hypothesis_file, stderr=subprocess.STDOUT)
      #bleu_cmd, stdin=read_pred, stderr=subprocess.STDOUT)
newmluser commented 5 years ago

what is that test.txt file. did any one get the solution to this isse=ue

deltahell commented 5 years ago

change in bleu.py

with open(hypothesis_file.name, "r") as read_pred:

with hypothesis_file as read_pred: Its worked for me.

hypothesis_file is create by python tempfile, its alerady file object;