Giter Site home page Giter Site logo

ValueError: Dimension must be 4 but is 3 for 'rnn/transpose' (op: 'Transpose') with input shapes: [20,?,160,100], [3]. about chatbot-retrieval HOT 1 CLOSED

dennybritz avatar dennybritz commented on June 3, 2024
ValueError: Dimension must be 4 but is 3 for 'rnn/transpose' (op: 'Transpose') with input shapes: [20,?,160,100], [3].

from chatbot-retrieval.

Comments (1)

pengcao avatar pengcao commented on June 3, 2024

chatbot-retrieval-master/udc_train.py
` INFO:tensorflow:Using config: {'_evaluation_master': '', '_num_ps_replicas': 0, '_tf_config': gpu_options {
per_process_gpu_memory_fraction: 1.0
}
, '_save_summary_steps': 100, '_master': '', '_keep_checkpoint_max': 5, '_cluster_spec': <tensorflow.python.training.server_lib.ClusterSpec object at 0x7fc3e5215588>, '_save_checkpoints_steps': None, '_task_id': 0, '_keep_checkpoint_every_n_hours': 10000, '_task_type': None, '_tf_random_seed': None, '_num_worker_replicas': 0, '_is_chief': True, '_environment': 'local', '_model_dir': None, '_save_checkpoints_secs': 600}
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.
INFO:tensorflow:No glove/vocab path specificed, starting with random embeddings.
INFO:tensorflow:Create CheckpointSaverHook.
2017-06-16 12:26:23.467688: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-06-16 12:26:23.467713: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-06-16 12:26:23.467720: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-06-16 12:26:23.467725: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-06-16 12:26:23.467729: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
INFO:tensorflow:Saving checkpoints for 1 into /home/yogesh/l7Project/chatbot-retrieval-master/runs/1497596182/model.ckpt.
INFO:tensorflow:step = 1, loss = 0.715735
INFO:tensorflow:No glove/vocab path specificed, starting with random embeddings.
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/common_shapes.py", line 671, in _call_cpp_shape_fn_impl
input_tensors_as_shapes, status)
File "/usr/lib/python3.5/contextlib.py", line 66, in exit
next(self.gen)
File "/usr/local/lib/python3.5/dist-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.InvalidArgumentError: Dimension must be 4 but is 3 for 'rnn/transpose' (op: 'Transpose') with input shapes: [20,?,160,100], [3].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/yogesh/l7Project/chatbot-retrieval-master/udc_train.py", line 64, in
tf.app.run()
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "/home/yogesh/l7Project/chatbot-retrieval-master/udc_train.py", line 61, in main
estimator.fit(input_fn=input_fn_train, steps=None, monitors=[eval_monitor])
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/util/deprecation.py", line 281, in new_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 430, in fit
loss = self._train_model(input_fn=input_fn, hooks=hooks)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 978, in _train_model
_, loss = mon_sess.run([model_fn_ops.train_op, model_fn_ops.loss])
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/monitored_session.py", line 484, in run
run_metadata=run_metadata)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/monitored_session.py", line 820, in run
run_metadata=run_metadata)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/monitored_session.py", line 776, in run
return self._sess.run(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/monitored_session.py", line 938, in run
run_metadata=run_metadata))
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/monitors.py", line 1155, in after_run
induce_stop = m.step_end(self._last_step, result)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/monitors.py", line 356, in step_end
return self.every_n_step_end(step, output)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/monitors.py", line 662, in every_n_step_end
name=self.name)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/util/deprecation.py", line 281, in new_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 518, in evaluate
log_progress=log_progress)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 804, in _evaluate_model
eval_dict = self._get_eval_ops(features, labels, metrics).eval_metric_ops
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 1160, in _get_eval_ops
features, labels, model_fn_lib.ModeKeys.EVAL)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 1103, in call_model_fn model_fn_results = self.model_fn(features, labels, **kwargs) File "/home/yogesh/l7Project/chatbot-retrieval-master/udc_model.py", line 85, in model_fn tf.concat([all_targets], 0)) File "/home/yogesh/l7Project/chatbot-retrieval-master/models/dual_encoder.py", line 57, in dual_encoder_model dtype=tf.float32) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/rnn.py", line 497, in dynamic_rnn for input in flat_input) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/rnn.py", line 497, in for input in flat_input)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/array_ops.py", line 1270, in transpose
ret = gen_array_ops.transpose(a, perm, name=name)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 3721, in transpose
result = _op_def_lib.apply_op("Transpose", x=x, perm=perm, name=name)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/op_def_library.py", line 768, in apply_op
op_def=op_def)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 2338, in create_op
set_shapes_for_outputs(ret)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 1719, in set_shapes_for_outputs
shapes = shape_func(op)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 1669, in call_with_requiring
return call_cpp_shape_fn(op, require_shape_fn=True)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/common_shapes.py", line 610, in call_cpp_shape_fn
debug_python_shape_fn, require_shape_fn)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/common_shapes.py", line 676, in _call_cpp_shape_fn_impl
raise ValueError(err.message)
ValueError: Dimension must be 4 but is 3 for 'rnn/transpose' (op: 'Transpose') with input shapes: [20,?,160,100], [3]. `

Process finished with exit code 1

change in udc_model.py as below :

probs, loss = model_impl( hparams, mode, tf.concat([all_contexts], 0), tf.concat([all_context_lens], 0), tf.concat([all_utterances], 0), tf.concat([all_utterance_lens], 0), tf.concat([all_targets], 0))

and dual_encoder.py contains this :

tf.concat([context_embedded, utterance_embedded], 0), sequence_length=tf.concat([context_len, utterance_len], 0), dtype=tf.float32) encoding_context, encoding_utterance = tf.split(rnn_states.h, 2, 0)

i have do the same , but still have errors

from chatbot-retrieval.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.