tf.layers.denseμ κ°μ κΈ°λ₯μ APIκ° TF 2.0μμ μ¬λΌμ§ κ²μ΄λΌλ κ²μ μκ³ μμ΅λλ€. κ·Έλ¬λ λμμΈ tf.keras.layersλ TF 1.xμ λ€λ₯Έ κ΅¬μ± μμμ νΈνλμ§ μμ΅λλ€. μλ₯Ό λ€μ΄ κ°λ³ λ²μλ₯Ό μ§μνμ§λ μμ΅λλ€(#27016). κ·Έλμ μ λ TF 1.xμμ λ μ΄μ μ¬μ©λμ§ μλ APIλ₯Ό κ³ μν κ²μ
λλ€.
xxx (from tensorflow.python.layers.core) is deprecated and will be removed in a future version. Use keras.layers.xxx instead.
μ κ°μ μκ²¨μ΄ "μ¬μ©λμ§ μλ" κ²½κ³ λ©μμ§λ₯Ό μ κ±°νμκ² μ΅λκΉ?
λΉμ μ μ΄κ²μ μ¬μ©ν μ μμ΅λλ€
μμ
OS
ν
μνλ‘λ₯Ό tfλ‘ κ°μ Έμ€κΈ°
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
μμΈν:-
0 = λͺ¨λ λ©μμ§κ° κΈ°λ‘λ¨(κΈ°λ³Έ λμ)
1 = INFO λ©μμ§κ° μΈμλμ§ μμ
2 = INFO λ° WARNING λ©μμ§κ° μΈμλμ§ μμ
3 = INFO, WARNING λ° ERROR λ©μμ§κ° μΈμλμ§ μμ
μ΄κ²μ λ΄κ° λͺ λ
λμ μ¬μ©νκ³ μλ κ²μ
λλ€
μ¬μ© μ€λ¨ κ²½κ³ λ₯Ό μ€μ§ν μ μμ΅λλ€.
그건 κ·Έλ κ³ , μ΄μ κ΅¬μ± μμλ₯Ό λ μ΄μ μ¬μ©νμ§ μκΈ° μ μ νμ¬ κΈ°λ₯μ μλ£νμκ² μ΅λκΉ? #27042λ₯Ό μ°Έμ‘°νμμμ€. TFλ λ리 μ¬μ©λλ κΈ°λ₯μ λΉμΆμ²νλ λ°λ λ§€μ° λ°μ΄λμ§λ§ μ½μ μ κ°μ νλ λ°λ μν΄λ€.
μ€μ λ²μ μ TensorFlowλ₯Ό μ¬μ©νλ €λ μ¬λλ€μκ² μμΌλ‘ μΌμ΄λ μΌμ μλ¦¬κ³ μ μν μκ°μ μ£ΌκΈ° μν΄ μ§μ μ€λ¨ λ©μμ§κ° νμν©λλ€.
λ°λΌμ μ΄λ¬ν λ©μμ§λ μμ ν μ μμ΅λλ€. μ΄ λΉκ³΅κ° APIλ₯Ό μ¬μ©νμ¬ μ§μ λΉνμ±νν μ μμ΅λλ€.
import tensorflow.python.util.deprecation as deprecation
deprecation._PRINT_DEPRECATION_WARNINGS = False
κ°μ¬ ν΄μ
#27045, μ μ μ¬νμ΄ μμ΅λκΉ?
μ΄ μ½λλ λμκ² μ€λ₯λ₯Ό μ£Όμλ€:
import tensorflow.python.util.deprecation as deprecation
deprecation._PRINT_DEPRECATION_WARNINGS = False
AttributeError: module 'tensorflow' has no attribute 'python'
κ·Έλ¬λ κ°μ Έμ€κΈ° μ€μ λ³κ²½νλ©΄ μλνκ² λ©λλ€(μνλ λλ‘ μ¬μ© μ€λ¨ κ²½κ³ κ° νμλμ§ μμ).
from tensorflow.python.util import deprecation
deprecation._PRINT_DEPRECATION_WARNINGS = False
κ°μ¬ ν΄μ
@skylogic004 μ΄κ²μ μ΅κ·Ό λ§μ€ν°μ μμ€μμ μ΅κ·Ό μΌκ°/λΉλμμ κ°μ Έμ¨ κ²μ λκΉ?
@mihaimaruseac μ€, μ λ μλμ½λ€μ tf 1.13μ μ¬μ©νκ³ μμ΅λλ€.
$ python
Python 3.6.6 | packaged by conda-forge | (default, Jul 26 2018, 11:48:23) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> tf.__version__
'1.13.1'
$ conda list | grep tensor
tensorboard 1.13.1 py36h33f27b4_0
tensorflow 1.13.1 gpu_py36h1635174_0
tensorflow-base 1.13.1 gpu_py36h0fff12a_0
tensorflow-estimator 1.13.0 py_0
tensorflow-gpu 1.13.1 h0d30ee6_0
μλμ½λ€ ν¨ν€μ§ λ§ν¬: https://anaconda.org/anaconda/tensorflow-gpu
κ·Έλ λ€λ©΄ κ±±μ ν νμκ° μμ΅λλ€(μ 체 컨ν μ€νΈ: μ§λ μ£Όμ λ΄κ° λ§λ μΌλΆ λ³κ²½μΌλ‘ μΈν΄ κ°μ Έμ€κΈ°μ μ½κ°μ μ€ν¨κ° μμμ§λ§ μ΄λ λ§μ€ν° μ½λμλ§ μλ κ²μ΄λ―λ‘ κ·Έλ μ§ μμ κ² κ°μ΅λλ€)
μ¬μ© μ€λ¨ κ²½κ³ λ κ°λ°μμκ² μ€μν©λλ€. μ¬μ©μμκ² κ·Έλ€μ§ μ μ©νμ§ μμ μ μμ΅λλ€. λ°λΌμ μ€μμΉλ₯Ό λλ κ²μ΄ λ°λμ§ν μν©μ΄ μμ΅λλ€.
Pythonμλ sys.warnoptions
κ° μμ΅λλ€. μλ₯Ό λ€μ΄ PYTHONWARNINGS
λ₯Ό ν΅ν΄ μ€μ ν μ μμ΅λλ€. μ:
PYTHONWARNINGS=ignore
.
TensorFlowμλ μμμ μ§μ ν λλ‘ μ체 TF_CPP_MIN_LOG_LEVEL
μ΅μ
μ΄ μμ΅λλ€.
κ·Έλ¦¬κ³ TensorFlow Python λ‘κΉ APIλ μμ΅λλ€(μ΄μ μ ν¨κ³Όκ° μλ€κ³ λ―Ώμμ΅λλ€).
import tensorflow as tf
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
μμ μ΄λ€ μ΅μ λ κ²½κ³ λ©μμ§κ° μΈμλλ κ²μ λ§μ§ λͺ»νλ€λ κ²μ λ²κ·ΈμΈ κ² κ°μ΅λλ€.
_PRINT_DEPRECATION_WARNINGS
νλκ·Έλ λ΄λΆμ μλ κ²μΌλ‘ 보μ΄λ©° μΈμ λ μ§ μ κ±°λ μ μμ΅λλ€.
νΈμ§: μ£μ‘ν©λλ€. tensorflow κ²½κ³ μ λν΄ numpy FuturreWarning μ νΌλνμ΅λλ€. λ‘κΉ μμ€μ μ€μ νλ λ§μ§λ§ μ΅μ μ μΌλ°μ μΌλ‘ μ¬μ ν μλν©λλ€.
1.14.0
μμλ§ μλν©λλ€.
import tensorflow as tf
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
r1.14 μ΄μμ κ²½μ° λ€μμ μλνμμμ€.
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
μ΄μ¨λ λ΄λΆμ μ΄κ³ λ³κ²½λ μ μμ΅λλ€.
λλ μ¬μ© μ€λ¨ κ²½κ³ κ° μ κ±°λ TF2.0μΌλ‘ μ νν©λλ€(νμνμ§ μμ κ²½μ°).
IDEλ₯Ό μ μ ννμ§ μλ ν :p
λλ₯Ό λ‘€λ°±νκ² λ§λ μ μΌν κ²μ μλ μμ± λ¬Έμ μμΌλ―λ‘ μ΄λ¬ν μ΅μ μμ²μ μ ν¨ν©λλ€.
μλ μμ±μ λλΆλΆ ν΄κ²°λμμ΅λλ€
μ μλ λͺ¨λ κ²μ μλνμ΅λλ€.
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
κ·ΈλΌμλ λΆκ΅¬νκ³ κ²½κ³ λλ―Έκ° μμ΅λλ€.
/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'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:517: 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'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:518: 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'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:519: 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'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:520: 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'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:525: 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'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: 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'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: 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'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: 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'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: 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'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: 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'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: 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'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
TF version 1.14.0
μ°λΆν¬ 16.04
νμ΄μ¬ 3.6.8
@pyotr777 νμ΄μ¬ λ΄μ₯ κ²½κ³ μ κ²½μ° λ€μμ μ¬μ©νμ¬ μ΅μ ν΄μΌ ν©λλ€.
warnings.filterwarnings('ignore', category=DeprecationWarning)
warnings.filterwarnings('ignore', category=FutureWarning)
@pyotr777 κ·Έκ²λ€μ numpyμμ μμ΅λλ€. μ¬μ© μ€μΈ TF λ²μ κ³Ό μ½κ° νΈνλμ§ μλ numpy λ²μ μ μ¬μ©νκ³ μμ΅λλ€.
λ λ§μ downvotesλ₯Ό μ»μ μνμ΄ μμΌλ―λ‘ 2.0μΌλ‘ μ ννμμμ€.
λ―Έλ κ²½κ³
import warnings
warnings.filterwarnings('ignore', category=DeprecationWarning)
warnings.filterwarnings('ignore', category=FutureWarning)
μ΅λλ₯΄μ§ μμλ€
/usr/local/lib/python3.7/site-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'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
λλ₯Ό μν΄ μ΄κ²μ t2.0 κ²½κ³ μ ν¨κ³Όμ μ΄μμ΅λλ€.
import tensorflow as tf
tf.get_logger().warning('test')
# WARNING:tensorflow:test
tf.get_logger().setLevel('ERROR')
tf.get_logger().warning('test')
FYI TF_CPP_MIN_LOG_LEVELμ΄ λ μ΄μ μλνμ§ μμ TensorFlowμ λ‘κ·ΈμΈμ΄ λ³κ²½λμμ΅λλ€.
κ·ΈλΌμλ λΆκ΅¬νκ³ κ²½κ³ λλ―Έκ° μμ΅λλ€.
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: (type, 1) λλ '1type'μ λμμ΄λ‘ μ λ¬νλ κ²μ λ μ΄μ μ¬μ©λμ§ μμ΅λλ€. numpyμ ν₯ν λ²μ μμλ (type, (1,)) / '(1,)type'μΌλ‘ μ΄ν΄λ κ²μ
λλ€.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: (type, 1) λλ '1type'μ λμμ΄λ‘ μ λ¬νλ κ²μ λ μ΄μ μ¬μ©λμ§ μμ΅λλ€. numpyμ ν₯ν λ²μ μμλ (type, (1,)) / '(1,)type'μΌλ‘ μ΄ν΄λ κ²μ
λλ€.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
1μ 0μΌλ‘ λ³κ²½νλ €λ©΄ ν λ²μ νλμ© μλνμμμ€. μ: _np_qint8 = np.dtype([("qint8", np.int8, 1)]) to _np_qint8 = np.dtype([("qint8", np.int8 , 0)]) μ μκ² ν¨κ³Όμ μ λλ€.
@TiwaPhil https://github.com/tensorflow/tensorflow/issues/27023#issuecomment -545991801
μ¬μ© μ€μΈ TF λ²μ κ³Ό μ½κ° νΈνλμ§ μλ numpy λ²μ μ μ¬μ©νκ³ μμ΅λλ€.
λλ₯Ό μν΄ νΌν μμ
import warnings
warnings.filterwarnings('ignore',category=FutureWarning)
~ μ μ
import tensorflow as tf
λ° κΈ°ν λͺ¨λ μμ ν.
TF 1.14.0κ³Ό numpy 1.18.1μ΄ μμ΅λλ€.
tensorflowλ₯Ό κ°μ Έμ€κΈ° μ μ λ€μμ ꡬνν΄μΌ ν©λλ€.
μμ
κ²½κ³
warnings.filterwarnings('무μ',category=FutureWarning)
warnings.filterwarnings('무μ', category=DeprecationWarning)
tensorflow==1.12.0, numpy==1.18.1, python 3.6μμ μλν©λλ€.
λλ μ΄κ²μ μλνλ€ :
import warnings
warnings.filterwarnings('ignore',category=FutureWarning)
warnings.filterwarnings('ignore', category=DeprecationWarning)
κ·Έλ¦¬κ³ κ·Έκ²μ λ΄κ°-λν νμ΄ μλ νμ΄μ¬ μ€ννμ λ λλ₯Ό μν΄ μλνμ§ μμλ€ tensorflow==1.14.0
, numpy==1.18.1
, python==3.6.10
, κ·Έλ¬λ λν ν μΈμ
μμ μμ
μνλ€.
λνμ λ° λΉλνμμΌλ‘ νμ΄μ¬μ μ€νν λ λ€μμ΄ μλνλ€λ κ²μ λ°κ²¬νμ΅λλ€. tensorflow 2.Xλ₯Ό μ¬μ©ν λ λ€μμ μ¬μ©ν μ μμ΅λλ€.
import tensorflow as tf
tf.logging.set_verbosity(tf.logging.ERROR)
κ·Έλ¦¬κ³ tensorflow 1.Xλ₯Ό μ¬μ©ν λ(1.14μμ μμ ):
import tensorflow as tf
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
λλ tf 1.13.1μ μ¬μ©νκ³ μλ€
μ΄κ²μ μλν©λλ€:
import tensorflow as tf
tf.logging.set_verbosity(tf.logging.ERROR)
.compat.v1
λ νμνμ§ μμ΅λλ€.
λλ λͺ¨λ λ°©λ²μ μλνμ§λ§ κ·Έλ€ μ€ λꡬλ jupyter notebookμμ μλνμ§ μμμ΅λλ€ ...
warnings.filterwarnings('ignore',category=FutureWarning)
μ΄κ²μ tensorflowλ₯Ό κ°μ Έμ¬ λ κ²½κ³ λ₯Ό 무μν μ μμ§λ§ λͺ¨λΈμ λ‘λνλ©΄ μ¬μ ν λ§μ WARNμ΄ μ‘΄μ¬ν©λλ€...
κ°μ₯ μ μ©ν λκΈ
1.14.0
μμλ§ μλν©λλ€.