When I run this code, this "Using TensorFlow backend" always pops up.
Even after I tried
import warnings
warnings.filterwarnings('ignore')
warnings.simplefilter('ignore)
I wonder whether I can get rid of it to make my notebook look cleaner.
Starting with tf-2.0 Keras is now the official high-level API of TensorFlow packaged within it. Not sure if it is a possibility in your case, but using tf-2.0 should remove this error. Here's a Quick Start guide if needed.
For most of the simple cases, just changing the import statement to import tensorflow.keras as keras gets it going.
Related
I am using python 3.8, spaCy 3.2.4, tensorflow 2.8.0, cuda 11.2, tensorflow-gpu 2.8.0. I want to import spacy, but it shows this error
import spacy
Process finished with exit code -1073740791 (0xC0000409)
Then, to fix this issue, I have to use this code
import tensorflow
import spacy
Now, it works. Although I already fixed the issue, I still want to know the reason behind the solution.
Furthermore, another question is when typing
import spacy
It shows:
Backend QtAgg is interactive backend. Turning interactive mode on.
How to always choose Qt5Agg or TkAgg instead of QtAgg? How to always turn on the interactive mode? I am using PyCharm IDE Community Edition 2020.3.5.
I am using some code based on Tensorflow 1.x and I am using the latest version of TensorFlow (2.8).
I have run tf_upgrade_v2 (following these migration instructions) on the python file to generate a new compatible file.
However, this doesn't work with the line of code; from TensorFlow.contrib import training as contrib_training.
Getting the error ModuleNotFoundError: No module named 'tensorflow.contrib'
I understand that contrib has been deprecated, so the modules have been moved around. But I haven't been able to find where this training module has moved to or if it has been deleted. I have looked for information first on this document on the status of tf.contrib and after this spreadsheet on TF2.0 Symbols map and haven't found any information on the fate of this training module;
I have also tried looking around TensforFlow/tf.compat.v1 but with no success.
Of course uninstalling this version of TensorFlow and instead installing an earlier version is an option. But not an option that I am overly keen on.
I feel like I may be missing something fairly obvious here...
Thanks in advance!!
The reason behind this error - ModuleNotFoundError: No module named 'tensorflow.contrib' is, tf.contrib has been deprected to use in Tensorflow 2.x. You can use Tensorflow Addons or Tensorflow Slim in the pace of tf.contrib api.
Please check this link for more details.
When I try to run code using keras and numpy or keras and Matplotlib in one Jupyter notebook I always get the message: The kernel appears to have died. It will restart automatically.
When I run the code in two different notebooks it works perfectly fine. I have installed it using anaconda and I am using macOS. I would really appreciate an answer, everything else I've found and tried so far did not work. Thank you!
I have a very simple question. I recently had to format my pc and therefore I recreated my whole working environment. I'm using Anaconda (latest version) and I used conda to install tensorflow-gpu, keras..
The code, like before, is working fine but I'm seeing a lot of warnings about deprecations and I'm sure a lot of them are related to tf version 2.x but I'm using tf 1.14 (I printed it after importing tensorflow in my code and so I'm sure, moreover I never asked Anaconda to install any 2.x version)
For example:
W0813 19:25:46.491560 15288 nn_ops.py:4224] Large dropout rate: 0.75 (>0.5).
In TensorFlow 2.x, dropout() uses dropout rate instead of keep_prob.
Please ensure that this is intended.
W0813 19:36:22.136491 15288 deprecation_wrapper.py:119]
From C:\Users\-----\Anaconda3\envs\tensorflow_GPU\lib\site-packages\keras\callbacks.py:850:
The name tf.summary.merge_all is deprecated.
Please use tf.compat.v1.summary.merge_all instead.
Is this normal? Do I have to correct them or can I disable this types of warnings?
The purpose of these warning messages is to spread awareness of TensorFlow 2.0
Because in the long run TF 2.X is likely to be widely adopted.
This is normal and you can safely ignore these warnings by,
import logging, os
logging.disable(logging.WARNING)
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
I get this error when I import modules from TensorFlow in PyCharm.
Cannot find reference 'keras' in 'init.py'
But when I use the tensorflow.python.keras prefix, the warning is not shown. Also, in the command line, no such warning is shown.
>> from tensorflow.keras import activations
>> # No errors!
How can I fix that warning in PyCharm and freely use tensorflow.keras and not tensorflow.python.keras? I'm using Windows 10, TF version 1.12.0 installed using Anaconda and PyCharm 2018.2.5.
After tensorflow gobbled keras, there were problem with tf.keras imports on IDEs although the code works.This was then raised an as issue (Issue #26502)
It seems that there is no import command for keras module in __init_.py of tensorflow package.
When I added from tensorflow.python import keras to __init__.py manually, everything work well.
Maybe there are some problem for package importing after keras was moved from _api to python.
As of tensorflow 2.0, even from tensorflow.python import keras wouldn't work: basically there is no way of making PyCharm / IDEA help you with syntax. However, this issue is fixed in IDEA 2019.3+ (currently in EAP, so should be in PyCharm EAP)