New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TF 1.x: remove the "deprecated" warning messages #27023
Comments
You can use this:- In detail:- |
this is what i have been using for years |
By the way, before deprecating old components, would you please complete the current functionality? See #27042. It seems that TF is very good at deprecating widely used functions, but poor at improving its weak points |
Deprecation messages are needed to inform people who want to use an actual version of TensorFlow what is going to happen in the future, and give them time to adapt. As such, we won't be able to remove these messages. You can disable them for yourself using this private API import tensorflow.python.util.deprecation as deprecation
deprecation._PRINT_DEPRECATION_WARNINGS = False |
Thanks |
This code gave me an error: import tensorflow.python.util.deprecation as deprecation
deprecation._PRINT_DEPRECATION_WARNINGS = False
But changing the import line made it work (and suppresses the deprecation warnings as desired): from tensorflow.python.util import deprecation
deprecation._PRINT_DEPRECATION_WARNINGS = False Thanks |
@skylogic004 is this from a recent nightly/build from source from recent master? |
@mihaimaruseac Oh, I'm using tf 1.13 from anaconda (I'm not familiar with what branch & build it would have come from originally, sorry, but maybe this is enough info for you?).
Link to anaconda package: https://anaconda.org/anaconda/tensorflow-gpu |
Then it's not something I should worry about (full context: over the past week there have been some failures on imports due to some changes I made; but those are only on master code, which doesn't seem to be the case) |
Deprecation warnings are important for developers. They may not be all that useful to users. Therefore there are situations where it is desirable to switch them off. Python has TensorFlow has it's own And there is also the TensorFlow Python logging API (which I believed worked before): import tensorflow as tf
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR) That none of the options above are preventing the warning messages from being printed seem to be a bug. The EDIT: Apologies, I was confusing the numpy FuturreWarnings for tensorflow warnings. The last option to set the logging level should generally still work. |
On
|
For r1.14 and onward, try this: try:
from tensorflow.python.util import module_wrapper as deprecation
except ImportError:
from tensorflow.python.util import deprecation_wrapper as deprecation
deprecation._PER_MODULE_WARNING_LIMIT = 0 Anyway, it is internal and subjects to change. |
Or switch to TF2.0 where deprecation warnings are removed (as not needed). |
Unless you use a good selection of IDE's :p |
Autocompletion has been mostly solved |
Tried all of what have been suggested: os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
from tensorflow.python.util import deprecation
deprecation._PRINT_DEPRECATION_WARNINGS = False
try:
from tensorflow.python.util import module_wrapper as deprecation
except ImportError:
from tensorflow.python.util import deprecation_wrapper as deprecation
deprecation._PER_MODULE_WARNING_LIMIT = 0 Still, have a pile of warnings.
Ubuntu 16.04 |
@pyotr777 For python builtin warnings, you should use following to suppress:
warnings.filterwarnings('ignore', category=DeprecationWarning)
warnings.filterwarnings('ignore', category=FutureWarning)
|
@pyotr777 those come from numpy. You are using a numpy version that is slightly incompatible with the TF version you're using. At the risk of getting more downvotes, please switch to 2.0 |
did not supress
|
For me this worked for t2.0 warning
FYI Logging in TensorFlow changed as TF_CPP_MIN_LOG_LEVEL is not working Anymore |
Still, have a pile of warnings. /usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. Please tried one at a time to change the 1 to 0 eg: _np_qint8 = np.dtype([("qint8", np.int8, 1)]) to _np_qint8 = np.dtype([("qint8", np.int8, 0)]) that works for me |
For me worked putting
before
and all other imports. I have TF 1.14.0 and numpy 1.18.1. |
before import tensorflow, you should implement: |
I tried this:
And it did not work for me when I ran python non-interactively |
I found that the following worked when I run python both interactively and non-interactively. When using tensorflow 2.X, you can use:
And when using tensorflow 1.X (worked on 1.14 for me):
|
This comment has been minimized.
This comment has been minimized.
I tried all methods, but none of them worked in jupyter notebook...
|
This work for me on python 3.6 and TensorFlow 2.2. Inspired from @bhushanbrb, thanks.
|
This indeed works. I tried every other suggestions provided above but none of them worked for me. But, this worked like a charm |
I know the functional APIs, such as tf.layers.dense, will disappear in TF 2.0. However, their alternatives, tf.keras.layers, are not compatible with other components of TF 1.x, for example, they even do not support variable scope (#27016). So I will stick on the deprecated APIs in TF 1.x.
Would you please remove the disgusting "deprecated" warning messages like this:
xxx (from tensorflow.python.layers.core) is deprecated and will be removed in a future version. Use keras.layers.xxx instead.
The text was updated successfully, but these errors were encountered: