A general-purpose encoder-decoder framework for Tensorflow

Overview

CircleCI


READ THE DOCUMENTATION

CONTRIBUTING


A general-purpose encoder-decoder framework for Tensorflow that can be used for Machine Translation, Text Summarization, Conversational Modeling, Image Captioning, and more.

Translation Model


The official code used for the Massive Exploration of Neural Machine Translation Architectures paper.

If you use this code for academic purposes, please cite it as:

@ARTICLE{Britz:2017,
  author          = {{Britz}, Denny and {Goldie}, Anna and {Luong}, Thang and {Le}, Quoc},
  title           = "{Massive Exploration of Neural Machine Translation Architectures}",
  journal         = {ArXiv e-prints},
  archivePrefix   = "arXiv",
  eprinttype      = {arxiv},
  eprint          = {1703.03906},
  primaryClass    = "cs.CL",
  keywords        = {Computer Science - Computation and Language},
  year            = 2017,
  month           = mar,
}

This is not an official Google product.

Comments
  • Various InvalidArgumentError in Evaluation

    Various InvalidArgumentError in Evaluation

    The error manifests in multiple ways, always during evaluation and some kind of shape error:

    • #102
    • #69
    • #98
    • #101

    Possible causes:

    • Some kind of bug in tf.learn evaluate that causes issues with the GPU during eva (this doesn't seem to be a problem with CPU training)
    • Mismatch of parameters or training data in training/eval
    • Issue with the data reading / input pipeline, e.g. mismatched sequence lengths.

    It could be related to these Tensorflow issues:

    • https://github.com/tensorflow/tensorflow/issues/7015
    • https://github.com/tensorflow/tensorflow/issues/6469

    For everyone having this issue, please answer the following to help debug:

    • What versions of TensorFlow are you using?
    • Can you run on the CPU without error?
    • What versions of CUDA are you using?
    bug 
    opened by dennybritz 74
  • nvalidArgumentError (see above for traceback): Tried to read from index 32 but array size is: 32

    nvalidArgumentError (see above for traceback): Tried to read from index 32 but array size is: 32

    Parsing GraphDef... Parsing RunMetadata... Parsing OpLog... Preparing Views... Traceback (most recent call last): File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main "main", fname, loader, pkg_name) File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/disk1/mouna/code/seq2seq/bin/train.py", line 251, in tf.app.run() File "/usr/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 44, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "/disk1/mouna/code/seq2seq/bin/train.py", line 246, in main schedule=FLAGS.schedule) File "/usr/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/learn_runner.py", line 106, in run return task() File "/usr/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/experiment.py", line 459, in train_and_evaluate self.train(delay_secs=0) File "/usr/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/experiment.py", line 281, in train monitors=self._train_monitors + extra_hooks) File "/usr/lib/python2.7/site-packages/tensorflow/python/util/deprecation.py", line 280, in new_func return func(*args, **kwargs) File "/usr/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 426, in fit loss = self._train_model(input_fn=input_fn, hooks=hooks) File "/usr/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 984, in _train_model _, loss = mon_sess.run([model_fn_ops.train_op, model_fn_ops.loss]) File "/usr/lib/python2.7/site-packages/tensorflow/python/training/monitored_session.py", line 462, in run run_metadata=run_metadata) File "/usr/lib/python2.7/site-packages/tensorflow/python/training/monitored_session.py", line 786, in run run_metadata=run_metadata) File "/usr/lib/python2.7/site-packages/tensorflow/python/training/monitored_session.py", line 744, in run return self._sess.run(*args, **kwargs) File "/usr/lib/python2.7/site-packages/tensorflow/python/training/monitored_session.py", line 899, in run run_metadata=run_metadata)) File "/usr/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/monitors.py", line 1157, in after_run induce_stop = m.step_end(self._last_step, result) File "/usr/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/monitors.py", line 356, in step_end return self.every_n_step_end(step, output) File "/usr/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/monitors.py", line 657, in every_n_step_end steps=self.eval_steps, metrics=self.metrics, name=self.name) File "/usr/lib/python2.7/site-packages/tensorflow/python/util/deprecation.py", line 280, in new_func return func(*args, **kwargs) File "/usr/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 514, in evaluate log_progress=log_progress) File "/usr/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 836, in _evaluate_model hooks=hooks) File "/usr/lib/python2.7/site-packages/tensorflow/contrib/training/python/training/evaluation.py", line 430, in evaluate_once session.run(eval_ops, feed_dict) File "/usr/lib/python2.7/site-packages/tensorflow/python/training/monitored_session.py", line 462, in run run_metadata=run_metadata) File "/usr/lib/python2.7/site-packages/tensorflow/python/training/monitored_session.py", line 786, in run run_metadata=run_metadata) File "/usr/lib/python2.7/site-packages/tensorflow/python/training/monitored_session.py", line 744, in run return self._sess.run(*args, **kwargs) File "/usr/lib/python2.7/site-packages/tensorflow/python/training/monitored_session.py", line 891, in run run_metadata=run_metadata) File "/usr/lib/python2.7/site-packages/tensorflow/python/training/monitored_session.py", line 744, in run return self._sess.run(*args, **kwargs) File "/usr/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 767, in run run_metadata_ptr) File "/usr/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 965, in _run feed_dict_string, options, run_metadata) File "/usr/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1015, in _do_run target_list, options, run_metadata) File "/usr/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1035, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InvalidArgumentError: Tried to read from index 32 but array size is: 32 [[Node: model/att_seq2seq/decode/attention_decoder_1/decoder/while/CustomHelperNextInputs/TrainingHelperNextInputs/cond/TensorArrayReadV3 = TensorArrayReadV3[_class=["loc:@model/att_seq2seq/decode/TrainingHelper/TensorArray"], dtype=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"](model/att_seq2seq/decode/attention_decoder_1/decoder/while/CustomHelperNextInputs/TrainingHelperNextInputs/cond/TensorArrayReadV3/Switch, model/att_seq2seq/decode/attention_decoder_1/decoder/while/CustomHelperNextInputs/TrainingHelperNextInputs/cond/TensorArrayReadV3/Switch_1/_463, model/att_seq2seq/decode/attention_decoder_1/decoder/while/CustomHelperNextInputs/TrainingHelperNextInputs/cond/TensorArrayReadV3/Switch_2)]]

    Caused by op u'model/att_seq2seq/decode/attention_decoder_1/decoder/while/CustomHelperNextInputs/TrainingHelperNextInputs/cond/TensorArrayReadV3', defined at: File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main "main", fname, loader, pkg_name) File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/disk1/mouna/code/seq2seq/bin/train.py", line 251, in tf.app.run() File "/usr/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 44, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "/disk1/mouna/code/seq2seq/bin/train.py", line 246, in main schedule=FLAGS.schedule) File "/usr/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/learn_runner.py", line 106, in run return task() File "/usr/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/experiment.py", line 459, in train_and_evaluate self.train(delay_secs=0) File "/usr/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/experiment.py", line 281, in train monitors=self._train_monitors + extra_hooks) File "/usr/lib/python2.7/site-packages/tensorflow/python/util/deprecation.py", line 280, in new_func return func(*args, **kwargs) File "/usr/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 426, in fit loss = self._train_model(input_fn=input_fn, hooks=hooks) File "/usr/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 984, in _train_model _, loss = mon_sess.run([model_fn_ops.train_op, model_fn_ops.loss]) File "/usr/lib/python2.7/site-packages/tensorflow/python/training/monitored_session.py", line 462, in run run_metadata=run_metadata) File "/usr/lib/python2.7/site-packages/tensorflow/python/training/monitored_session.py", line 786, in run run_metadata=run_metadata) File "/usr/lib/python2.7/site-packages/tensorflow/python/training/monitored_session.py", line 744, in run return self._sess.run(*args, **kwargs) File "/usr/lib/python2.7/site-packages/tensorflow/python/training/monitored_session.py", line 899, in run run_metadata=run_metadata)) File "/usr/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/monitors.py", line 1157, in after_run induce_stop = m.step_end(self._last_step, result) File "/usr/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/monitors.py", line 356, in step_end return self.every_n_step_end(step, output) File "/usr/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/monitors.py", line 657, in every_n_step_end steps=self.eval_steps, metrics=self.metrics, name=self.name) File "/usr/lib/python2.7/site-packages/tensorflow/python/util/deprecation.py", line 280, in new_func return func(*args, **kwargs) File "/usr/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 514, in evaluate log_progress=log_progress) File "/usr/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 810, in _evaluate_model eval_ops = self._get_eval_ops(features, labels, metrics) File "/usr/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 1190, in _get_eval_ops features, labels, model_fn_lib.ModeKeys.EVAL) File "/usr/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 1133, in _call_model_fn model_fn_results = self._model_fn(features, labels, **kwargs) File "/disk1/mouna/code/seq2seq/bin/train.py", line 164, in model_fn return model(features, labels, params) File "seq2seq/models/model_base.py", line 111, in call return self._build(features, labels, params) File "seq2seq/models/seq2seq_model.py", line 263, in _build decoder_output, _, = self.decode(encoder_output, features, labels) File "seq2seq/graph_utils.py", line 38, in func_wrapper return templated_func(*args, **kwargs) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/template.py", line 276, in call return self._call_func(args, kwargs, check_for_new_variables=False) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/template.py", line 216, in _call_func result = self._func(*args, **kwargs) File "seq2seq/models/basic_seq2seq.py", line 124, in decode labels) File "seq2seq/models/basic_seq2seq.py", line 87, in _decode_train return decoder(decoder_initial_state, helper_train) File "seq2seq/graph_module.py", line 57, in call return self._template(*args, **kwargs) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/template.py", line 267, in call return self._call_func(args, kwargs, check_for_new_variables=False) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/template.py", line 216, in _call_func result = self._func(*args, **kwargs) File "seq2seq/decoders/rnn_decoder.py", line 110, in _build maximum_iterations=maximum_iterations) File "seq2seq/contrib/seq2seq/decoder.py", line 282, in dynamic_decode swap_memory=swap_memory) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2605, in while_loop result = context.BuildLoop(cond, body, loop_vars, shape_invariants) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2438, in BuildLoop pred, body, original_loop_vars, loop_vars, shape_invariants) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2388, in BuildLoop body_result = body(*packed_vars_for_body) File "seq2seq/contrib/seq2seq/decoder.py", line 242, in body decoder_finished) = decoder.step(time, inputs, state) File "seq2seq/decoders/attention_decoder.py", line 186, in step time=time, outputs=outputs, state=cell_state, sample_ids=sample_ids) File "seq2seq/contrib/seq2seq/helper.py", line 125, in next_inputs time=time, outputs=outputs, state=state, sample_ids=sample_ids) File "seq2seq/decoders/attention_decoder.py", line 154, in att_next_inputs name=name) File "seq2seq/contrib/seq2seq/helper.py", line 204, in next_inputs lambda: nest.map_structure(read_from_ta, self._input_tas)) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 1745, in cond _, res_f = context_f.BuildCondBranch(fn2) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 1639, in BuildCondBranch r = fn() File "seq2seq/contrib/seq2seq/helper.py", line 204, in lambda: nest.map_structure(read_from_ta, self._input_tas)) File "/usr/lib/python2.7/site-packages/tensorflow/python/util/nest.py", line 302, in map_structure structure[0], [func(*x) for x in entries]) File "seq2seq/contrib/seq2seq/helper.py", line 200, in read_from_ta return inp.read(next_time) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/tensor_array_ops.py", line 250, in read name=name) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/gen_data_flow_ops.py", line 2421, in _tensor_array_read_v3 name=name) File "/usr/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 763, in apply_op op_def=op_def) File "/usr/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2327, in create_op original_op=self._default_original_op, op_def=op_def) File "/usr/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1226, in init self._traceback = _extract_stack()

    InvalidArgumentError (see above for traceback): Tried to read from index 32 but array size is: 32 [[Node: model/att_seq2seq/decode/attention_decoder_1/decoder/while/CustomHelperNextInputs/TrainingHelperNextInputs/cond/TensorArrayReadV3 = TensorArrayReadV3[_class=["loc:@model/att_seq2seq/decode/TrainingHelper/TensorArray"], dtype=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"](model/att_seq2seq/decode/attention_decoder_1/decoder/while/CustomHelperNextInputs/TrainingHelperNextInputs/cond/TensorArrayReadV3/Switch, model/att_seq2seq/decode/attention_decoder_1/decoder/while/CustomHelperNextInputs/TrainingHelperNextInputs/cond/TensorArrayReadV3/Switch_1/_463, model/att_seq2seq/decode/attention_decoder_1/decoder/while/CustomHelperNextInputs/TrainingHelperNextInputs/cond/TensorArrayReadV3/Switch_2)]]

    opened by mouna99 13
  • ImportError: cannot import name contrib

    ImportError: cannot import name contrib

    Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main "main", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/usr/lib/python2.7/unittest/main.py", line 12, in main(module=None) File "/usr/lib/python2.7/unittest/main.py", line 94, in init self.parseArgs(argv) File "/usr/lib/python2.7/unittest/main.py", line 149, in parseArgs self.createTests() File "/usr/lib/python2.7/unittest/main.py", line 158, in createTests self.module) File "/usr/lib/python2.7/unittest/loader.py", line 130, in loadTestsFromNames suites = [self.loadTestsFromName(name, module) for name in names] File "/usr/lib/python2.7/unittest/loader.py", line 91, in loadTestsFromName module = import('.'.join(parts_copy)) File "seq2seq/init.py", line 24, in from seq2seq import contrib ImportError: cannot import name contrib When I run"python -m unittest seq2seq.test.pipeline_test",I got this error.Could someone tell me how to solve this problem?

    opened by tangzhenyu 12
  • failed to allocate 11.90G CUDA_ERROR_OUT_OF_MEMORY

    failed to allocate 11.90G CUDA_ERROR_OUT_OF_MEMORY

    When i try the WMT'16 EN-DE sample, encountered the following CUDA_ERROR_OUT_OF_MEMORY:

    name: TITAN X (Pascal) major: 6 minor: 1 memoryClockRate (GHz) 1.531 pciBusID 0000:01:00.0 Total memory: 11.90GiB Free memory: 11.39GiB I tensorflow/core/common_runtime/gpu/gpu_device.cc:906] DMA: 0 I tensorflow/core/common_runtime/gpu/gpu_device.cc:916] 0: Y I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:0) -> (device: 0, name: TITAN X (Pascal), pci bus id: 0000:01:00.0) E tensorflow/stream_executor/cuda/cuda_driver.cc:1002] failed to allocate 11.90G (12778405888 bytes) from device: CUDA_ERROR_OUT_OF_MEMORY Traceback (most recent call last): File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main "main", mod_spec) File "/usr/lib/python3.4/runpy.py", line 85, in _run_code exec(code, run_globals) File "/media/sbai/7A9C9BED9C9BA1E5/DL/seq2seq/bin/train.py", line 251, in tf.app.run() File "/home/sbai/tf134/lib/python3.4/site-packages/tensorflow/python/platform/app.py", line 44, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "/media/sbai/7A9C9BED9C9BA1E5/DL/seq2seq/bin/train.py", line 246, in main schedule=FLAGS.schedule) File "/home/sbai/tf134/lib/python3.4/site-packages/tensorflow/contrib/learn/python/learn/learn_runner.py", line 106, in run return task() File "/home/sbai/tf134/lib/python3.4/site-packages/tensorflow/contrib/learn/python/learn/experiment.py", line 459, in train_and_evaluate self.train(delay_secs=0) File "/home/sbai/tf134/lib/python3.4/site-packages/tensorflow/contrib/learn/python/learn/experiment.py", line 281, in train monitors=self._train_monitors + extra_hooks) File "/home/sbai/tf134/lib/python3.4/site-packages/tensorflow/python/util/deprecation.py", line 280, in new_func return func(*args, **kwargs) File "/home/sbai/tf134/lib/python3.4/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 426, in fit loss = self._train_model(input_fn=input_fn, hooks=hooks) File "/home/sbai/tf134/lib/python3.4/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 984, in _train_model _, loss = mon_sess.run([model_fn_ops.train_op, model_fn_ops.loss]) File "/home/sbai/tf134/lib/python3.4/site-packages/tensorflow/python/training/monitored_session.py", line 462, in run run_metadata=run_metadata) File "/home/sbai/tf134/lib/python3.4/site-packages/tensorflow/python/training/monitored_session.py", line 786, in run run_metadata=run_metadata) File "/home/sbai/tf134/lib/python3.4/site-packages/tensorflow/python/training/monitored_session.py", line 744, in run return self._sess.run(*args, **kwargs) File "/home/sbai/tf134/lib/python3.4/site-packages/tensorflow/python/training/monitored_session.py", line 883, in run feed_dict, options) File "/home/sbai/tf134/lib/python3.4/site-packages/tensorflow/python/training/monitored_session.py", line 909, in _call_hook_before_run request = hook.before_run(run_context) File "/media/sbai/7A9C9BED9C9BA1E5/DL/seq2seq/seq2seq/training/hooks.py", line 239, in before_run "predicted_tokens": self._pred_dict["predicted_tokens"], KeyError: 'predicted_tokens'

    Env: TF1.0 GPU & Python3.4 & ubuntu14.04 I changed the batch size and the num_units into a smaller number, but still encountered the same error. I tried toy data, met the same error. Is it because I am using python3.4?

    ############################### update ############### I tried it on Python3.5, got the same error at the first try, and got following error when i tried again:

    WARNING:tensorflow:From /usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/monitors.py:267: BaseMonitor.init (from tensorflow.contrib.learn.python.learn.monitors) is deprecated and will be removed after 2016-12-05. Instructions for updating: Monitors are deprecated. Please use tf.train.SessionRunHook. *** Error in `python3.5': double free or corruption (!prev): 0x0000000002870d90 *** Aborted (core dumped)

    opened by zzks 10
  • find an error when run command:python -m unittest seq2seq.test.pipeline_test

    find an error when run command:python -m unittest seq2seq.test.pipeline_test

    ~/desktop/code/python_program/seq2seq$ python -m unittest seq2seq.test.pipeline_test .E

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

    Traceback (most recent call last): File "seq2seq/test/pipeline_test.py", line 78, in test_train_infer os.path.join(BIN_FOLDER, "train.py")) UnicodeEncodeError: 'ascii' codec can't encode characters in position 11-12: ordinal not in range(128)


    Ran 2 tests in 0.003s

    FAILED (errors=1)

    opened by victorustc 10
  • unit test error

    unit test error

    on centos Python 2.7, Tensorflow 1.01 when i run the command:python -m unittest seq2seq.test.pipeline_test there are some errors,like: image

    how can i fix it

    bug 
    opened by ruiquanhe 8
  • How to develop beam search with a set of predefined responses?

    How to develop beam search with a set of predefined responses?

    In the original paper of SmartReply:

    First, the elements of R (possible set of responses) are organized into a trie. Then, we conduct a left-to-right beam search, but only retain hypotheses that appear in the trie. This search process has complexity O(bl) for beam size b and maximum response length l. Both b and l are typically in the range of 10-30, so this method dramatically reduces the time to find the top responses and is a critical element of making this system deployable.

    Would you please consider this feature and add a detailed task list to this issue for interested contributors.

    opened by amirj 8
  • run pipeline_test.py

    run pipeline_test.py

    I have install seq2seq sucessfully in window 10 with tensorflow-gpu (1.0) when I run the seq2seq.test.pipeline_test.py it Prompt errors:

    Traceback (most recent call last): File "F:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\ops\script_ops.py", line 85, in call ret = func(*args) File "H:\java_pro\tensorflow\project_src\seq2seq-master\seq2seq-master\seq2seq\metrics\metric_specs.py", line 132, in _py_func return self.metric_fn(sliced_hypotheses, sliced_references) File "H:\java_pro\tensorflow\project_src\seq2seq-master\seq2seq-master\seq2seq\metrics\metric_specs.py", line 157, in metric_fn return bleu.moses_multi_bleu(hypotheses, references, lowercase=False) File "H:\java_pro\tensorflow\project_src\seq2seq-master\seq2seq-master\seq2seq\metrics\bleu.py", line 71, in moses_multi_bleu with open(hypothesis_file.name, "r") as read_pred: PermissionError: [Errno 13] Permission denied: 'C:\Users\gdy\AppData\Local\Temp\tmpjo9ekggj' W c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\framework\op_kernel.cc:993] Internal: Failed to run py callback pyfunc_0: see error log. EF:\Program Files\Anaconda3\lib\unittest\case.py:628: ResourceWarning: unclosed file <_io.BufferedRandom name=3> outcome.errors.clear() F:\Program Files\Anaconda3\lib\unittest\case.py:628: ResourceWarning: unclosed file <_io.BufferedRandom name=4> outcome.errors.clear() F:\Program Files\Anaconda3\lib\unittest\case.py:628: ResourceWarning: unclosed file <_io.BufferedRandom name=5> outcome.errors.clear() F:\Program Files\Anaconda3\lib\unittest\case.py:628: ResourceWarning: unclosed file <_io.BufferedRandom name=6> outcome.errors.clear() F:\Program Files\Anaconda3\lib\unittest\case.py:628: ResourceWarning: unclosed file <_io.BufferedRandom name=7> outcome.errors.clear() F:\Program Files\Anaconda3\lib\unittest\case.py:628: ResourceWarning: unclosed file <_io.BufferedRandom name=8> outcome.errors.clear()

    opened by gdyxml2000 8
  • Illegal Division by Zero

    Illegal Division by Zero

    During training my model, I get a lot of warnings:

    INFO:tensorflow:Starting evaluation at 2017-03-24-04:29:49
    WARNING:tensorflow:multi-bleu.perl script returned non-zero exit code
    WARNING:tensorflow:b'Illegal division by zero at /tmp/tmpu0_b8sc7 line 154, <STDIN> line 32.\n'
    WARNING:tensorflow:multi-bleu.perl script returned non-zero exit code
    WARNING:tensorflow:b'Illegal division by zero at /tmp/tmp7em8bjou line 154, <STDIN> line 64.\n'
    WARNING:tensorflow:multi-bleu.perl script returned non-zero exit code
    WARNING:tensorflow:b'Illegal division by zero at /tmp/tmp4osfwiwt line 154, <STDIN> line 96.\n'
    ...
    

    Then I use something below to run the prediction, but get a blank file.

    python -m bin.infer \
      --tasks "
        - class: DecodeText" \
      --model_dir $MODEL_DIR \
      --input_pipeline "
        class: ParallelTextInputPipeline
        params:
          source_files:
            - $DEV_SOURCES" \
      >  ${PRED_DIR}/predictions.txt
    

    I'm trying to do text summarization, using the following command:

    python -m bin.train \
      --config_paths="
          ./example_configs/nmt_medium.yml,
          ./example_configs/train_seq2seq.yml,
          ./example_configs/text_metrics_sp.yml" \
      --model_params "
          vocab_source: $VOCAB_SOURCE
          vocab_target: $VOCAB_TARGET" \
      --input_pipeline_train "
        class: ParallelTextInputPipeline
        params:
          source_files:
            - $TRAIN_SOURCES
          target_files:
            - $TRAIN_TARGETS" \
      --input_pipeline_dev "
        class: ParallelTextInputPipeline
        params:
           source_files:
            - $DEV_SOURCES
           target_files:
            - $DEV_TARGETS" \
      --batch_size 32 \
      --train_steps $TRAIN_STEPS \
      --output_dir $MODEL_DIR
    

    I don't know where is wrong, and how to debug.

    opened by tangrui 7
  • ImportError: cannot import name contrib

    ImportError: cannot import name contrib

    Hi all, Following the page at https://google.github.io/seq2seq/getting_started/, got error

    user@localhost:~/Desktop/seq2seq$ pip install -e .
    Obtaining file:///home/user/Desktop/seq2seq
    Requirement already satisfied: numpy in /home/user/anaconda2/lib/python2.7/site-packages (from seq2seq==0.1)
    Requirement already satisfied: matplotlib in /home/user/anaconda2/lib/python2.7/site-packages (from seq2seq==0.1)
    Requirement already satisfied: pyyaml in /home/user/anaconda2/lib/python2.7/site-packages (from seq2seq==0.1)
    Requirement already satisfied: pyrouge in /home/user/anaconda2/lib/python2.7/site-packages (from seq2seq==0.1)
    Requirement already satisfied: six>=1.10 in /home/user/anaconda2/lib/python2.7/site-packages (from matplotlib->seq2seq==0.1)
    Requirement already satisfied: python-dateutil in /home/user/anaconda2/lib/python2.7/site-packages (from matplotlib->seq2seq==0.1)
    Requirement already satisfied: functools32 in /home/user/anaconda2/lib/python2.7/site-packages (from matplotlib->seq2seq==0.1)
    Requirement already satisfied: subprocess32 in /home/user/anaconda2/lib/python2.7/site-packages (from matplotlib->seq2seq==0.1)
    Requirement already satisfied: pytz in /home/user/anaconda2/lib/python2.7/site-packages (from matplotlib->seq2seq==0.1)
    Requirement already satisfied: cycler>=0.10 in /home/user/anaconda2/lib/python2.7/site-packages (from matplotlib->seq2seq==0.1)
    Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=1.5.6 in /home/user/anaconda2/lib/python2.7/site-packages (from matplotlib->seq2seq==0.1)
    Installing collected packages: seq2seq
      Running setup.py develop for seq2seq
    Successfully installed seq2seq
    user@localhost:~/Desktop/seq2seq$ python -m unittest seq2seq.test.pipeline_test
    Traceback (most recent call last):
      File "/home/user/anaconda2/lib/python2.7/runpy.py", line 174, in _run_module_as_main
        "__main__", fname, loader, pkg_name)
      File "/home/user/anaconda2/lib/python2.7/runpy.py", line 72, in _run_code
        exec code in run_globals
      File "/home/user/anaconda2/lib/python2.7/unittest/__main__.py", line 12, in 
        main(module=None)
      File "/home/user/anaconda2/lib/python2.7/unittest/main.py", line 94, in __init__
        self.parseArgs(argv)
      File "/home/user/anaconda2/lib/python2.7/unittest/main.py", line 149, in parseArgs
        self.createTests()
      File "/home/user/anaconda2/lib/python2.7/unittest/main.py", line 158, in createTests
        self.module)
      File "/home/user/anaconda2/lib/python2.7/unittest/loader.py", line 130, in loadTestsFromNames
        suites = [self.loadTestsFromName(name, module) for name in names]
      File "/home/user/anaconda2/lib/python2.7/unittest/loader.py", line 91, in loadTestsFromName
        module = __import__('.'.join(parts_copy))
      File "seq2seq/__init__.py", line 24, in 
        from seq2seq import contrib
    ImportError: cannot import name contrib
    

    PS: It should be pip install -e . at https://google.github.io/seq2seq/getting_started/

    opened by zhang-jian 7
  • ImportError: cannot import name contrib

    ImportError: cannot import name contrib

    while running the pipeline unit test, i get this error

    Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/usr/lib/python2.7/unittest/__main__.py", line 12, in <module> main(module=None) File "/usr/lib/python2.7/unittest/main.py", line 94, in __init__ self.parseArgs(argv) File "/usr/lib/python2.7/unittest/main.py", line 149, in parseArgs self.createTests() File "/usr/lib/python2.7/unittest/main.py", line 158, in createTests self.module) File "/usr/lib/python2.7/unittest/loader.py", line 130, in loadTestsFromNames suites = [self.loadTestsFromName(name, module) for name in names] File "/usr/lib/python2.7/unittest/loader.py", line 91, in loadTestsFromName module = __import__('.'.join(parts_copy)) File "seq2seq/__init__.py", line 24, in <module> from seq2seq import contrib ImportError: cannot import name contrib

    opened by NajeebTyson 6
  • Can I decode embedings to sequences using seq2seq?

    Can I decode embedings to sequences using seq2seq?

    I have a naive question, if I have a pre-trained transformer model (pre-train task is a regression probelem), can I using the embedding of this model to training a decode model to decode embeddings to sequences, as like a translation task? I wonder if seq2seq can help me on this task. Thanks, anyway.

    opened by Wang-Lin-boop 1
  • ModuleNotFoundError: No module named 'tensorflow.contrib'

    ModuleNotFoundError: No module named 'tensorflow.contrib'

    Got this error.

    ERROR: seq2seq (unittest.loader._FailedTest)

    ImportError: Failed to import test module: seq2seq Traceback (most recent call last): File "C:\Users\jtobo\AppData\Local\Programs\Python\Python39\lib\unittest\loader.py", line 154, in loadTestsFromName module = import(module_name) File "C:\Users\jtobo\seq2seq\seq2seq_init_.py", line 25, in from seq2seq import data File "C:\Users\jtobo\seq2seq\seq2seq\data_init_.py", line 17, in from seq2seq.data import input_pipeline File "C:\Users\jtobo\seq2seq\seq2seq\data\input_pipeline.py", line 32, in from tensorflow.contrib.slim.python.slim.data import tfexample_decoder ModuleNotFoundError: No module named 'tensorflow.contrib'


    Ran 1 test in 0.000s

    FAILED (errors=1)

    opened by DrR0bot 2
  • python -m unittest seq2seq.test.pipeline_test -> ModuleNotFoundError: No module named 'seq2seq'

    python -m unittest seq2seq.test.pipeline_test -> ModuleNotFoundError: No module named 'seq2seq'

    seq2seq/test/pipeline_test.py:25: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses

    import imp

    Traceback (most recent call last):

    File "seq2seq/test/pipeline_test.py", line 35, in <module>

    `from seq2seq.test import utils as test_utils`
    

    ModuleNotFoundError: No module named 'seq2seq'

    I get this error when running the unit test pipeline_test. Any suggestions to solve the problem?

    opened by fsnajafali 2
  • Error On Setup

    Error On Setup

    Not sure whats going on, but when I try the setup I get an error

    ImportError: Failed to import test module: seq2seq
    Traceback (most recent call last):
      File "C:\Users\charl\AppData\Local\Programs\Python\Python37\lib\unittest\loader.py", line 154, in loadTestsFromName
        module = __import__(module_name)
      File "C:\Users\charl\Documents\Chatbot\seq2seq\seq2seq\__init__.py", line 26, in <module>
        from seq2seq import decoders
      File "C:\Users\charl\Documents\Chatbot\seq2seq\seq2seq\decoders\__init__.py", line 20, in <module>
        from seq2seq.decoders.attention_decoder import *
      File "C:\Users\charl\Documents\Chatbot\seq2seq\seq2seq\decoders\attention_decoder.py", line 27, in <module>
        from seq2seq.contrib.seq2seq.helper import CustomHelper
      File "C:\Users\charl\Documents\Chatbot\seq2seq\seq2seq\contrib\seq2seq\helper.py", line 35, in <module>
        from tensorflow.contrib.distributions.python.ops import bernoulli
    ImportError: cannot import name 'bernoulli' from 'tensorflow.contrib.distributions.python.ops' (C:\Users\charl\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_core\contrib\distributions\python\ops\__init__.py)
    
    
    ----------------------------------------------------------------------
    Ran 1 test in 0.001s
    
    FAILED (errors=1)
    

    What is going on? How can I fix it?

    opened by Charlotte-Stuff 1
  • How to build a character based seq2seq tensorflow model for spell correction?

    How to build a character based seq2seq tensorflow model for spell correction?

    I am trying to build a character based seq2seq model using tensorflow for food item names correction. The input/output would be like

    IN: Cheessseee Quisadillas

    OUT: Cheese Quesadillas

    I have tried training a word level seq2seq but it does not give much good results. I have also read that we only used attention mechanism on long sequences and I have a Maximum of 6 word sentence(Item Name).

    Apart from this, Can I use a language model like BERT or GPT for such task

    Can anyone please suggest the changes or provide better resources for implementing the same.?

    opened by murtuzamdahod 0
Owner
Google
Google ❤️ Open Source
Google
DeepLabv3+:Encoder-Decoder with Atrous Separable Convolution语义分割模型在tensorflow2当中的实现

DeepLabv3+:Encoder-Decoder with Atrous Separable Convolution语义分割模型在tensorflow2当中的实现 目录 性能情况 Performance 所需环境 Environment 注意事项 Attention 文件下载 Download

Bubbliiiing 31 Nov 25, 2022
An implementation of a sequence to sequence neural network using an encoder-decoder

Keras implementation of a sequence to sequence model for time series prediction using an encoder-decoder architecture. I created this post to share a

Luke Tonin 195 Dec 17, 2022
This repository contains the data and code for the paper "Diverse Text Generation via Variational Encoder-Decoder Models with Gaussian Process Priors" (SPNLP@ACL2022)

GP-VAE This repository provides datasets and code for preprocessing, training and testing models for the paper: Diverse Text Generation via Variationa

Wanyu Du 18 Dec 29, 2022
ZSL-KG is a general-purpose zero-shot learning framework with a novel transformer graph convolutional network (TrGCN) to learn class representation from common sense knowledge graphs.

ZSL-KG is a general-purpose zero-shot learning framework with a novel transformer graph convolutional network (TrGCN) to learn class representa

Bats Research 94 Nov 21, 2022
General purpose GPU compute framework for cross vendor graphics cards (AMD, Qualcomm, NVIDIA & friends)

General purpose GPU compute framework for cross vendor graphics cards (AMD, Qualcomm, NVIDIA & friends). Blazing fast, mobile-enabled, asynchronous and optimized for advanced GPU data processing usecases. Backed by the Linux Foundation.

The Kompute Project 1k Jan 6, 2023
Implementation of self-attention mechanisms for general purpose. Focused on computer vision modules. Ongoing repository.

Self-attention building blocks for computer vision applications in PyTorch Implementation of self attention mechanisms for computer vision in PyTorch

AI Summer 962 Dec 23, 2022
a general-purpose Transformer based vision backbone

Swin Transformer By Ze Liu*, Yutong Lin*, Yue Cao*, Han Hu*, Yixuan Wei, Zheng Zhang, Stephen Lin and Baining Guo. This repo is the official implement

Microsoft 9.9k Jan 8, 2023
BYOL for Audio: Self-Supervised Learning for General-Purpose Audio Representation

BYOL for Audio: Self-Supervised Learning for General-Purpose Audio Representation This is a demo implementation of BYOL for Audio (BYOL-A), a self-sup

NTT Communication Science Laboratories 160 Jan 4, 2023
ImVoxelNet: Image to Voxels Projection for Monocular and Multi-View General-Purpose 3D Object Detection

ImVoxelNet: Image to Voxels Projection for Monocular and Multi-View General-Purpose 3D Object Detection This repository contains implementation of the

Visual Understanding Lab @ Samsung AI Center Moscow 190 Dec 30, 2022
A task-agnostic vision-language architecture as a step towards General Purpose Vision

Towards General Purpose Vision Systems By Tanmay Gupta, Amita Kamath, Aniruddha Kembhavi, and Derek Hoiem Overview Welcome to the official code base f

AI2 79 Dec 23, 2022
A general-purpose, flexible, and easy-to-use simulator alongside an OpenAI Gym trading environment for MetaTrader 5 trading platform (Approved by OpenAI Gym)

gym-mtsim: OpenAI Gym - MetaTrader 5 Simulator MtSim is a simulator for the MetaTrader 5 trading platform alongside an OpenAI Gym environment for rein

Mohammad Amin Haghpanah 184 Dec 31, 2022
Unofficial PyTorch implementation of MobileViT based on paper "MobileViT: Light-weight, General-purpose, and Mobile-friendly Vision Transformer".

MobileViT RegNet Unofficial PyTorch implementation of MobileViT based on paper MOBILEVIT: LIGHT-WEIGHT, GENERAL-PURPOSE, AND MOBILE-FRIENDLY VISION TR

Hong-Jia Chen 91 Dec 2, 2022
A general-purpose programming language, focused on simplicity, safety and stability.

The Rivet programming language A general-purpose programming language, focused on simplicity, safety and stability. Rivet's goal is to be a very power

The Rivet programming language 17 Dec 29, 2022
Implementation of Perceiver, General Perception with Iterative Attention in TensorFlow

Perceiver This Python package implements Perceiver: General Perception with Iterative Attention by Andrew Jaegle in TensorFlow. This model builds on t

Rishit Dagli 84 Oct 15, 2022
Code for ACM MM2021 paper "Complementary Trilateral Decoder for Fast and Accurate Salient Object Detection"

CTDNet The PyTorch code for ACM MM2021 paper "Complementary Trilateral Decoder for Fast and Accurate Salient Object Detection" Requirements Python 3.6

CVTEAM 28 Oct 20, 2022
MAME is a multi-purpose emulation framework.

MAME's purpose is to preserve decades of software history. As electronic technology continues to rush forward, MAME prevents this important "vintage" software from being lost and forgotten.

Michael Murray 6 Oct 25, 2020
(CVPR2021) ClassSR: A General Framework to Accelerate Super-Resolution Networks by Data Characteristic

ClassSR (CVPR2021) ClassSR: A General Framework to Accelerate Super-Resolution Networks by Data Characteristic Paper Authors: Xiangtao Kong, Hengyuan

Xiangtao Kong 308 Jan 5, 2023