Closed shahawi closed 6 years ago
This error occurred with new tensor2tensor starting from version 1.6.0. We are working on this issue now. Please, install the previous version of tensor2tensor=1.5.7
Hi, Is there a way to install older version of tensorflow for cpu in ubuntu Thanks
Yes, please read the tensorflow installation documentation: https://www.tensorflow.org/install/install_linux#the_url_of_the_tensorflow_python_package
Hi, I installed version 1.5 of tensorflow and tensor2tensor but now I get this error Thanks in advance.
(tensorflow) hosni@hosni-Inspiron-3521:~/g2p-seq2seq$ python setup.py test
running test
running egg_info
writing requirements to g2p_seq2seq.egg-info/requires.txt
writing g2p_seq2seq.egg-info/PKG-INFO
writing top-level names to g2p_seq2seq.egg-info/top_level.txt
writing dependency_links to g2p_seq2seq.egg-info/dependency_links.txt
writing entry points to g2p_seq2seq.egg-info/entry_points.txt
reading manifest file 'g2p_seq2seq.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'g2p_seq2seq.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
File "setup.py", line 53, in <module>
test_suite = 'tests'
File "/home/hosni/tensorflow/local/lib/python2.7/site-packages/setuptools/__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/hosni/tensorflow/local/lib/python2.7/site-packages/setuptools/command/test.py", line 226, in run
self.run_tests()
File "/home/hosni/tensorflow/local/lib/python2.7/site-packages/setuptools/command/test.py", line 248, in run_tests
exit=False,
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 "/home/hosni/g2p-seq2seq/tests/__init__.py", line 23, in <module>
from tests import g2p_unittest
File "/home/hosni/g2p-seq2seq/tests/g2p_unittest.py", line 4, in <module>
import g2p_seq2seq.g2p as g2p
File "/home/hosni/g2p-seq2seq/g2p_seq2seq/__init__.py", line 28, in <module>
from g2p_seq2seq import g2p_problem
File "/home/hosni/g2p-seq2seq/g2p_seq2seq/g2p_problem.py", line 32, in <module>
from tensor2tensor.data_generators import text_problems
ImportError: cannot import name text_problems
(tensorflow) hosni@hosni-Inspiron-3521:~/g2p-seq2seq$ python setup.py test
What version of tensor2tensor had you install?
Can you, please, check:
>>> import pkg_resources
>>> pkg_resources.get_distribution("tensor2tensor").version
'1.5.0'
sorry for late reply
now I get this
(tensorflow) hosni@hosni-Inspiron-3521:~$ g2p-seq2seq --interactive --model_dir /home/hosni/g2p-seq2seq/g2p-seq2seq-cmudict
Traceback (most recent call last):
File "/home/hosni/tensorflow/bin/g2p-seq2seq", line 11, in <module>
load_entry_point('g2p-seq2seq==6.1.3a0', 'console_scripts', 'g2p-seq2seq')()
File "/home/hosni/tensorflow/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 561, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/home/hosni/tensorflow/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2631, in load_entry_point
return ep.load()
File "/home/hosni/tensorflow/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2291, in load
return self.resolve()
File "/home/hosni/tensorflow/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2297, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/home/hosni/tensorflow/local/lib/python2.7/site-packages/g2p_seq2seq-6.1.3a0-py2.7.egg/g2p_seq2seq/__init__.py", line 28, in <module>
from g2p_seq2seq import g2p_problem
File "/home/hosni/tensorflow/local/lib/python2.7/site-packages/g2p_seq2seq-6.1.3a0-py2.7.egg/g2p_seq2seq/g2p_problem.py", line 32, in <module>
from tensor2tensor.data_generators import text_problems
ImportError: cannot import name text_problems
(tensorflow) hosni@hosni-Inspiron-3521:~$
Also
(tensorflow) hosni@hosni-Inspiron-3521:~/g2p-seq2seq$ sudo python setup.py test
running test
running egg_info
writing requirements to g2p_seq2seq.egg-info/requires.txt
writing g2p_seq2seq.egg-info/PKG-INFO
writing top-level names to g2p_seq2seq.egg-info/top_level.txt
writing dependency_links to g2p_seq2seq.egg-info/dependency_links.txt
writing entry points to g2p_seq2seq.egg-info/entry_points.txt
reading manifest file 'g2p_seq2seq.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'g2p_seq2seq.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
File "setup.py", line 53, in <module>
test_suite = 'tests'
File "/usr/lib/python2.7/dist-packages/setuptools/__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/dist-packages/setuptools/command/test.py", line 226, in run
self.run_tests()
File "/usr/lib/python2.7/dist-packages/setuptools/command/test.py", line 248, in run_tests
exit=False,
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 "/home/hosni/g2p-seq2seq/tests/__init__.py", line 23, in <module>
from tests import g2p_unittest
File "/home/hosni/g2p-seq2seq/tests/g2p_unittest.py", line 4, in <module>
import g2p_seq2seq.g2p as g2p
File "/home/hosni/g2p-seq2seq/g2p_seq2seq/__init__.py", line 28, in <module>
from g2p_seq2seq import g2p_problem
File "/home/hosni/g2p-seq2seq/g2p_seq2seq/g2p_problem.py", line 32, in <module>
from tensor2tensor.data_generators import text_problems
ImportError: cannot import name text_problems
(tensorflow) hosni@hosni-Inspiron-3521:~/g2p-seq2seq$
(tensorflow) hosni@hosni-Inspiron-3521:~/g2p-seq2seq$ pip show tensorflow
Name: tensorflow
Version: 1.5.0
Summary: TensorFlow helps the tensors flow
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: opensource@google.com
License: Apache 2.0
Location: /home/hosni/tensorflow/lib/python2.7/site-packages
Requires: mock, protobuf, wheel, absl-py, backports.weakref, enum34, six, numpy, tensorflow-tensorboard
Required-by:
(tensorflow) hosni@hosni-Inspiron-3521:~/g2p-seq2seq$ pip show tensor2tensor
Name: tensor2tensor
Version: 1.5.0
Summary: Tensor2Tensor
Home-page: http://github.com/tensorflow/tensor2tensor
Author: Google Inc.
Author-email: no-reply@google.com
License: Apache 2.0
Location: /usr/local/lib/python2.7/dist-packages
Requires: six, numpy, requests, flask, gunicorn, google-api-python-client, bz2file, gevent, sympy, scipy, future, gym
Required-by: g2p-seq2seq
Ok, I could reproduce your error. Install the tensor2tensor version=1.5.7
Duplicate of issue #114
Im having the same problem in decoding but with t2t version 1.5.4
@nimaous Can you, please, install t2t version 1.5.7 ?
I installed v 1.5.7 but still the same error
Traceback (most recent call last):
File "/sopran/rafiee/py3/lib/python3.4/site-packages/tensorflow/python/framework/op_def_library.py", line 510, in _apply_op_helper
preferred_dtype=default_dtype)
File "/sopran/rafiee/py3/lib/python3.4/site-packages/tensorflow/python/framework/ops.py", line 1036, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/sopran/rafiee/py3/lib/python3.4/site-packages/tensorflow/python/framework/constant_op.py", line 235, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "/sopran/rafiee/py3/lib/python3.4/site-packages/tensorflow/python/framework/constant_op.py", line 214, in constant
value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "/sopran/rafiee/py3/lib/python3.4/site-packages/tensorflow/python/framework/tensor_util.py", line 433, in make_tensor_proto
_AssertCompatible(values, dtype)
File "/sopran/rafiee/py3/lib/python3.4/site-packages/tensorflow/python/framework/tensor_util.py", line 344, in _AssertCompatible
(dtype.name, repr(mismatch), type(mismatch).__name__))
TypeError: Expected int32, got 0.0 of type 'float' instead.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/sopran/rafiee/py3/bin/t2t-decoder", line 16, in <module>
tf.app.run()
File "/sopran/rafiee/py3/lib/python3.4/site-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "/sopran/rafiee/py3/bin/t2t-decoder", line 12, in main
t2t_decoder.main(argv)
File "/sopran/rafiee/py3/lib/python3.4/site-packages/tensor2tensor/bin/t2t_decoder.py", line 188, in main
decode(estimator, hp, decode_hp)
File "/sopran/rafiee/py3/lib/python3.4/site-packages/tensor2tensor/bin/t2t_decoder.py", line 101, in decode
dataset_split="test" if FLAGS.eval_use_test_set else None)
File "/sopran/rafiee/py3/lib/python3.4/site-packages/tensor2tensor/utils/decoding.py", line 160, in decode_from_dataset
for num_predictions, prediction in enumerate(predictions):
File "/sopran/rafiee/py3/lib/python3.4/site-packages/tensorflow/python/estimator/estimator.py", line 479, in predict
features, None, model_fn_lib.ModeKeys.PREDICT, self.config)
File "/sopran/rafiee/py3/lib/python3.4/site-packages/tensorflow/python/estimator/estimator.py", line 793, in _call_model_fn
model_fn_results = self._model_fn(features=features, **kwargs)
File "/sopran/rafiee/py3/lib/python3.4/site-packages/tensor2tensor/utils/t2t_model.py", line 889, in wrapping_model_fn
use_tpu=use_tpu)
File "/sopran/rafiee/py3/lib/python3.4/site-packages/tensor2tensor/utils/t2t_model.py", line 934, in estimator_model_fn
return model.estimator_spec_predict(features)
File "/sopran/rafiee/py3/lib/python3.4/site-packages/tensor2tensor/utils/t2t_model.py", line 1057, in estimator_spec_predict
decode_length=decode_hparams.extra_length)
File "/sopran/rafiee/py3/lib/python3.4/site-packages/tensor2tensor/utils/t2t_model.py", line 540, in infer
top_beams, alpha)
File "/sopran/rafiee/py3/lib/python3.4/site-packages/tensor2tensor/models/transformer.py", line 293, in _beam_decode
features, decode_length, beam_size, top_beams, alpha)
File "/sopran/rafiee/py3/lib/python3.4/site-packages/tensor2tensor/models/transformer.py", line 363, in _fast_decode
inputs, features["target_space_id"], hparams, orig_inp, features=features, template_flag=False)
File "/sopran/rafiee/py3/lib/python3.4/site-packages/tensor2tensor/utils/expert_utils.py", line 254, in __call__
outputs.append(fns[i](*my_args[i], **my_kwargs[i]))
File "/sopran/rafiee/py3/lib/python3.4/site-packages/tensor2tensor/models/transformer.py", line 99, in encode
orig_inp, target_space, hparams, features=features))
File "/sopran/rafiee/py3/lib/python3.4/site-packages/tensor2tensor/models/transformer.py", line 649, in transformer_prepare_encoder
encoder_padding = common_attention.embedding_to_padding(encoder_input)
File "/sopran/rafiee/py3/lib/python3.4/site-packages/tensor2tensor/utils/expert_utils.py", line 85, in decorated
return f(*args, **kwargs)
File "/sopran/rafiee/py3/lib/python3.4/site-packages/tensor2tensor/layers/common_attention.py", line 690, in embedding_to_padding
return tf.to_float(tf.equal(emb_sum, 0.0))
File "/sopran/rafiee/py3/lib/python3.4/site-packages/tensorflow/python/ops/gen_math_ops.py", line 1489, in equal
"Equal", x=x, y=y, name=name)
File "/sopran/rafiee/py3/lib/python3.4/site-packages/tensorflow/python/framework/op_def_library.py", line 519, in _apply_op_helper
repr(values), type(values).__name__))
TypeError: Expected int32 passed to parameter 'y' of op 'Equal', got 0.0 of type 'float' instead.
Just good to know that in transformer model. I split my input and feed into the two seperate encoders. in _fast_decode I also splite my input data and call encoder twice with two splited inputs. in training and evaluation it works perfect but in decoding by calling below function I got the error. the point is that this function is also called in transformer body (when encoder is called) without any error ( in training and evaluation phase)
dp(self.encode,
inputs1, features["target_space_id"], hparams, original_inp, features=features, template_flag=False)
Hi @nimaous have you tried checking out the latest commit it fixed my problems
Hi @shahawi can you send me a link to that commit?
Git pull the repository from the same directory
I'm not sure whether this is the same error or not, but I saw a similar error when trying to kick of object detection training:
WARNING:tensorflow:Estimator's model_fn (<function create_model_fn.<locals>.model_fn at 0x7f464c3ed7b8>) includes params argument, but params are not passed to Estimator.
The rootcause was that I had a really small number of training steps --num_train_steps
given to object_detection/model_main.py
script, that was smaller than the number of eval steps --num_eval_steps
given to the script, and also smaller than number of steps specified in graph_rewriter.quantization.delay
parameter. When I made num_train_steps
to be higher than both of them, I stopped seeing the error and the training script ran successfully.
@nekulkarni I got the warning as yours.
WARNING:tensorflow:Forced number of epochs for all eval validations to be 1.
W1016 14:59:22.730520 139906006693376 tf_logging.py:125] Forced number of epochs for all eval validations to be 1.
WARNING:tensorflow:Expected number of evaluation epochs is 1, but instead encountered eval_on_train_input_config.num_epochs
= 0. Overwriting num_epochs
to 1.
W1016 14:59:22.730715 139906006693376 tf_logging.py:125] Expected number of evaluation epochs is 1, but instead encountered eval_on_train_input_config.num_epochs
= 0. Overwriting num_epochs
to 1.
WARNING:tensorflow:Estimator's model_fn (<function create_model_fn.
The param numtrain_steps I used is 200000. I set num_examples = 408 and max_evals = 10 in eval_config (pipeline_config file). Can you suggest any solution? Thanks
@tringn Can you share what arguments you provided to your model_main.py
?
Hi, after running test I get those errors please advice Thanks.