conflict between TF 2.0 and T2T 1.14.1

118 views
Skip to first unread message

Weiguang Guan

unread,
Oct 15, 2019, 7:51:50 PM10/15/19
to tensor2tensor
"pip list" shows  
...

tensor2tensor                      
1.14.1
tensorboard                        
2.0.0
tensorflow                        
2.0.0
tensorflow
-datasets                1.2.0
tensorflow
-estimator               2.0.0
tensorflow
-gan                     1.0.0.dev0
tensorflow
-gpu                     2.0.0
tensorflow
-metadata                0.15.0
tensorflow
-probability             0.7.0
...


When I run bert-multitask-learning, I got error message shown below:
Traceback (most recent call last):
 
File "Run_Self_Defined_Problem.py", line 14, in <module>
   
from bert_multitask_learning import (get_or_make_label_encoder, FullTokenizer,
 
File "/lustre03/project/6007993/rrs99/code/bert-multitask-learning/bert_multitask_learning/__init__.py", line 4, in <module>
   
from .model_fn import *
 
File "/lustre03/project/6007993/rrs99/code/bert-multitask-learning/bert_multitask_learning/model_fn.py", line 10, in <module>
   
from .top import (
 
File "/lustre03/project/6007993/rrs99/code/bert-multitask-learning/bert_multitask_learning/top.py", line 9, in <module>
   
from .top_utils import (TopLayer, gather_indexes,
 
File "/lustre03/project/6007993/rrs99/code/bert-multitask-learning/bert_multitask_learning/top_utils.py", line 7, in <module>
   
from tensor2tensor.utils import metrics as t2t_metrics
 
File "/lustre03/project/6007993/rrs99/venvs/bert_multi/lib/python3.6/site-packages/tensor2tensor/utils/metrics.py", line 25, in <module>
   
from tensor2tensor.layers import modalities
 
File "/lustre03/project/6007993/rrs99/venvs/bert_multi/lib/python3.6/site-packages/tensor2tensor/layers/modalities.py", line 28, in <module>
   
from tensor2tensor.layers import common_attention
 
File "/lustre03/project/6007993/rrs99/venvs/bert_multi/lib/python3.6/site-packages/tensor2tensor/layers/common_attention.py", line 954, in <module>
   
def attention_bias_to_padding(attention_bias, cast_fn=tf.to_float):
AttributeError: module 'tensorflow' has no attribute 'to_float'


The error message tells me that TF doesn't have function to_float defined. To check it, I did the following experiment:
>>> import tensorflow as tf
>>> tf.to_float
Traceback (most recent call last):
 
File "<stdin>", line 1, in <module>
AttributeError: module 'tensorflow' has no attribute 'to_float'

However, in my_virtualenv/lib/python3.6/site-packages/tensorflow_core/python/ops/math_ops.py, it DOES define to_float although it is deprecated:
@deprecation.deprecated(date=None, instructions="Use `tf.cast` instead.")
@tf_export(v1=["to_float"])
def to_float(x, name="ToFloat"):
......


Can anyone elaborate on this problem? Thanks a lot.

Weiguang

Sumeet Singh

unread,
Oct 17, 2019, 3:54:03 PM10/17/19
to tensor2tensor
I am facing the same problem. I suppose one could just stay on TF 1.15. However, I am looking to change the tensor2tensor code and so am wondering what the dependency requirements are for working on the tensor2tensor repo. (I don't think I should be installing the tensor2tensor package, since I'll be actively developing code within the repo)

Sumeet Singh

unread,
Oct 17, 2019, 4:46:48 PM10/17/19
to tensor2tensor
Forgot to mention that I am on Python 3. I suspect tensor2tensor works best with Python 2. (and by the way the there are no tensorflow 1.15 packages for python 3, but tensorflow_probability 0.8 requires min tensorflow v1.15).

Weiguang Guan

unread,
Oct 17, 2019, 7:31:39 PM10/17/19
to tensor2tensor
I actually installed TF 1.14 before installing T2T. However, I don't know why the installation of T2T triggers the installation of TF 2.0 even though 1.14 is there already. Thinking the latest version of T2T might depend on TF 2.0, I did another test --- installing TF 1.14 and T2T 1.13. Guess what -- it triggers the installation TF 2.0 again. 

What's even stranger to me is the fact installing T2T triggers the installation of TF 2.0 what is not compatible with T2T. Can someone explain it?

Weiguang

Paige Bailey

unread,
Oct 17, 2019, 7:44:13 PM10/17/19
to Weiguang Guan, Martin Wicke, tensor2tensor
Adding +Martin Wicke.

--
You received this message because you are subscribed to the Google Groups "tensor2tensor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tensor2tenso...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tensor2tensor/284115cc-665a-4c37-8da6-c27a82f18d2b%40googlegroups.com.


--

Paige Bailey   

Product Manager (TensorFlow)

@DynamicWebPaige

webp...@google.com


 

Lukasz Kaiser

unread,
Oct 17, 2019, 7:53:14 PM10/17/19
to Paige Bailey, Weiguang Guan, Martin Wicke, tensor2tensor
It looks like some recent changes in Mesh TF dependencies triggered this. We are investigating.

Lukasz

Sumeet Singh

unread,
Oct 21, 2019, 4:55:16 PM10/21/19
to tensor2tensor
Got it to work with Python 3.6 using pipenv --skip-lock. Pasting the pipfile for what its worth.

[[source]]
name = "pypi"
verify_ssl = true

[dev-packages]

[packages]
tensorflow = "==1.15.*"
tensorflow-probability = "*"
scipy = "*"
requests = "*"
mesh-tensorflow = "*"
gym = "*"
pillow = "*"
tensorflow-gan = "*"
sympy = "*"
pypng = "*"
google-api-python-client = "*"
oauth2client = "*"
jupyter = "*"
matplotlib = "*"

[requires]
python_version = "3.6"

[pipenv]
allow_prereleases = true


On Tuesday, October 15, 2019 at 4:51:50 PM UTC-7, Weiguang Guan wrote:
Reply all
Reply to author
Forward
0 new messages