The version of linux I am using is ubuntu 14.04. I wanted to know my tensorflow version, so I ran a script given in the tensorflow directory tf_version_script.lds with the command ld tf_version_script.lds and it gave this error-
ld:/home/me/tensorflow/tensorflow/tf_version_script.lds:1: syntax error
I had the directory mounted. Why is this happening?
tf_version_script.lds is a linker version script used to specify to the GNU linker what symbols to make global, and what symbols to keep local. It has nothing to do with TensorFlow version, although I agree that its name is somewhat misleading.
If you have installed TensorFlow via the pip package, you can run the following to know what version of TensorFlow is installed :
$ pip freeze | grep tensorflow
# prints tensorflow==0.9.0
Or, if you have installed TensorFlow from sources, you can also print out the version in Python as follows :
import tensorflow as tf
print(tf.__version__)
# print '0.9.0'
In >jupyter notebook
import tensorflow as tf
import keras as ks
print("TensorFlow version : ")
print(tf.__version__)
print("Keras version : ")
print(ks.__version__)
or
print("TensorFlow version : " + tf.__version__)
print("Keras version : " + ks.__version__)
Out >Output after run
TensorFlow version :
1.14.0
Keras version :
2.2.4
or
TensorFlow version : 1.14.0
Keras version : 2.2.4
Related
I have TensorFlow 1.15 running in Anaconda env on my windows PC. Now I created a separate env and I installed TensorFlow 2. When I try to run "python object_detection/builders/model_builder_tf2_test.py" for TensorFlow 2 then it is looking for files in TensorFlow 1 API folder and shows no attribute 'contrib'. I have attached a screenshot please let me know how can I solve this.
Schreenshot
I am running this colab from Roboflow: https://colab.research.google.com/drive/1ByRi9d6_Yzu0nrEKArmLMLuMaZjYfygO#scrollTo=WgHANbxqWJPa
The code should be as-is, but i get errors at the end...
I suspect a TF versioning issue, but how do i know which version of TF i should install instead?
It should use TF1:
%tensorflow_version 1.x
But
!python -c 'import keras;
print(keras.version)'
returns: Using TensorFlow backend. 2.2.4
What am i doing wrong here? Unistall TF & reinstall which version?
Thanx
Fred
Would you help me to achieve reproducible results with Tensorflow 1.15 without restarting Python kernel. And why the output results in TF 2.0 and TF 1.5 are different with absolutely identical parameters and dataset? Is it possible to achieve identical output?
More details:
I tried to interpret model results in TF 2.0 by:
import shap
background = df3.iloc[np.random.choice(df3.shape[0], 100, replace=False)]
explainer = shap.DeepExplainer(model, background)
I recieved an error:
`get_session` is not available when using TensorFlow 2.0.`get_session` is not available when using TensorFlow 2.0.
According to the SO topic, I tried to setup TF 2.0 compatibility with TF 1 by using in the front of my code:
import tensorflow.compat.v1 as tf
But the error appeared again.
Following advice by many users, I downgraded TF2 to TF 1.15 it solved the problem, and shap module interprets the results but:
1) to make results reproducible now I have to change tf.random.set_seed(7) on tf.random.set_random_seed(7) and restart the Python kernel every time! In TF2 I didn't have to restart the kernel.
2) prediction results has been changed, especially, Economical efficiency (that is, TF1.5. wrongly classifies more important samples than TF2.0).
TF 2:
Accuracy: 94.95%, Economical efficiency = 64%
TF 1:
Accuracy: 94.85%, Economical efficiency = 56%
The code of the model is here
First, results differ from each other not only in TF1 and TF2 versions, but also in TF2.0 and TF2.2 versions. Probably, it depends on diffenent internal parameters in the packages.
Second, TensorFlow2 works with DeepExplainer in the following versions:
import tensorflow
import pandas as pd
import keras
import xgboost
import numpy
import shap
print(tensorflow.__version__)
print(pd.__version__)
print(keras.__version__)
print(xgboost.__version__)
print(numpy.__version__)
print(shap.__version__)
output:
2.2.0
0.24.2
2.3.1
0.90
1.17.5
0.35.0
But you will face some difficulties in updating the libraries.
In Python 3.5, running TF2.2, you will face the error 'DLL load failed: The specified module could not be found'.
It 100% can be solved by installing newer C++ package. See this:https://github.com/tensorflow/tensorflow/issues/22794#issuecomment-573297027
Link to download the package:https://support.microsoft.com/ru-ru/help/2977003/the-latest-supported-visual-c-downloads
In Python 3.7 you will not find the shap 0.35.0 version with whl extention. Only tar.gz extension which gives the error: "Install visual c++ package". But installation doesn't help.
Then download shap 0.35.0 for Python 3.7 here: https://anaconda.org/conda-forge/shap/files. Run Anaconda shell. Type: conda install -c conda-forge C:\shap-0.35.0-py37h3bbf574_0.tar.bz2.
Nothing seems to work when I try to identify the version of an imported package:
What is creating this problem? What can I do about it?
I am using Python 3.7, Anaconda3 (2019) and Windows 10.
If I try it in notebooks.azure.com then everything works just fine:
import tensorflow
tensorflow.__version__
'1.12.2'
You can also try:
!pip show tensorflow
Name: tensorflow
Version: 1.12.2
Summary: TensorFlow is an open source machine learning framework for everyone.
/..../
I tried pip installing 0.3.1, but when I print the version it outputs 2.1.4.
!pip install keras==0.3.1
import keras
print keras._version__
I am trying to train deepmask (https://github.com/abbypa/NNProject_DeepMask/) for which I specifically need 0.3.1.
Note that if you've already loaded keras, then the second import statement has no effect.
So first !pip install keras==0.3.1, then restart your kernel (ctrl-m . or Runtime -> Restart runtime) and then things should work as expected.