Closed shravankumar9892 closed 5 years ago
What's the version of your tensorflow
? It should has tf.gfile
by default.
I had the same error. It's tensorflow 2.0 the new version.
It may be the API change from TensorFlow 2.0
.
We may change the usage of this API for this newer version.
Thank you!
Hi @shravankumar9892 @anyaozm,
Could you solve the problem? My tensorflow version is 2.0.0-alpha0, but i still encounter the "AttributeError: module 'tensorflow' has no attribute 'gfile'" error after running the line ''' simple_tensorflow_serving --model_base_path="./models/tensorflow_template_application_model'''
Thank you
Hi @tsakunelson, I uninstalled Tensorflow and all the files from the repository I pip installed. The installed TensorFlow and did the 2nd option and bazel built instead of doing the pip. It worked. You might wanna try pip3 if you’re using python 3. But the other setup worked for me.
any new update on tf.gfile issue ? if the API has changed what would be the new one in TF-2.0 ?
I will update this project for TensorFlow 2.0 when it's officially released. Any contribution is welcome if you are interested in this.
In tf2.0 , the gfile package has been moved into tf.io. so u can use tf.io.gfile
Thanks all. This have been resolved by https://github.com/tobegit3hub/simple_tensorflow_serving/commit/e9adcaa46d6af448321d70bcac0b4544eba4935f .
And we have done more code change to make STFS to run with TensorFlow 2.x now.
Tensor-flow Version - 2.0.0-alpha0
Same error occurred while running a notebook from the Tensorflow site - Build a linear model with Estimators
Download the dataset:
from official.wide_deep import census_dataset
from official.wide_deep import census_main
census_dataset.download("/tmp/census_data/")
AttributeError Traceback (most recent call last)
in () 2 from official.wide_deep import census_main 3 ----> 4 census_dataset.download("/tmp/census_data/") /content/models/official/wide_deep/census_dataset.py in download(data_dir) 76 def download(data_dir): 77 """Download census data if it is not already present.""" ---> 78 **tf.gfile.MakeDirs(data_dir)** 79 80 training_file_path = os.path.join(data_dir, TRAINING_FILE) **AttributeError: module 'tensorflow' has no attribute 'gfile'**
WARNING: Logging before flag parsing goes to stderr. W0625 16:04:36.412110 139807458662144 deprecation_wrapper.py:119] From /tmpfs/src/temp/site/en/tutorials/estimators/models/official/wide_deep/census_dataset.py:78: The name tf.gfile.MakeDirs is deprecated. Please use tf.io.gfile.makedirs instead.
W0625 16:04:36.413802 139807458662144 deprecation_wrapper.py:119] From /tmpfs/src/temp/site/en/tutorials/estimators/models/official/wide_deep/census_dataset.py:81: The name tf.gfile.Exists is deprecated. Please use tf.io.gfile.exists instead.
W0625 16:04:38.253764 139807458662144 deprecation_wrapper.py:119] From /tmpfs/src/temp/site/en/tutorials/estimators/models/official/wide_deep/census_dataset.py:62: The name tf.gfile.Open is deprecated. Please use tf.io.gfile.GFile instead.
W0625 16:04:38.488776 139807458662144 deprecation_wrapper.py:119] From /tmpfs/src/temp/site/en/tutorials/estimators/models/official/wide_deep/census_dataset.py:73: The name tf.gfile.Remove is deprecated. Please use tf.io.gfile.remove instead.
@Gurubux It was resolved in this problem with new TensorFlow APIs.
Hi, I am still facing the same issue even after using tensorflow 2.2 and chaning the configuration as mentioned. Please look at image below.
Same here. Same issue still exists even with Tf2.2.0. The error comes while working with tokenization.FullTokenizer(vocab_file, do_lower_case) so we cant even go to the file and change it
I trained a simple mnist model with tensorflow 2.0 on Google Colab and saved it in the .json format. Then on running the command
!simple_tensorflow_serving --model_base_path="/" --model_platform="tensorflow"
It is showing the error AttributeError: module 'tensorflow' has no attribute 'gfile'