본문 바로가기
Programming/Tips

[tensorflow] WARNING:tensorflow:AutoGraph could not transform 해결방법

by a voyager 2020. 10. 30.
728x90
반응형
728x90

[Tip] WARNING:tensorflow:AutoGraph could not transform 해결방법

 

tensorflow 2.0으로 오면서 Keras 신경망 모델을 훈련시키다 다음과 같은 경고 메시지를 보게 되었다. 이 문제 때문에 한참 찾아봤는데 이제야 해결책을 찾았다. 

 

WARNING:tensorflow:AutoGraph could not transform <function Model.make_train_function.<locals>.train_function at 0x7fdfc302fea0> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output.
Cause: 'arguments' object has no attribute 'posonlyargs'
To silence this warning, decorate the function with @tf.autograph.experimental.do_not_convert
WARNING: AutoGraph could not transform <function Model.make_train_function.<locals>.train_function at 0x7fdfc302fea0> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output.
Cause: 'arguments' object has no attribute 'posonlyargs'
To silence this warning, decorate the function with @tf.autograph.experimental.do_not_convert
WARNING:tensorflow:Callbacks method `on_train_batch_end` is slow compared to the batch time (batch time: 0.0025s vs `on_train_batch_end` time: 0.0578s). Check your callbacks.
WARNING:tensorflow:AutoGraph could not transform <function Model.make_test_function.<locals>.test_function at 0x7fdfbfeae840> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output.
Cause: 'arguments' object has no attribute 'posonlyargs'
To silence this warning, decorate the function with @tf.autograph.experimental.do_not_convert
WARNING: AutoGraph could not transform <function Model.make_test_function.<locals>.test_function at 0x7fdfbfeae840> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output.
Cause: 'arguments' object has no attribute 'posonlyargs'
To silence this warning, decorate the function with @tf.autograph.experimental.do_not_convert

 

 

위 메세지는 에러가 아니기 때문에 결과에 영향을 주진 않지만 파이썬 노트북이나 터미널에서 결과를 보기가 안 좋아진다. 메시지의 원인은 2.0으로 업데이트가 되면서 Autograph의 버전과 충돌을 일으키기 때문인 것으로 보인다. 

 

이것은 다음과 같이 gast를 설치해 주면 해결할 수 있다. 

 

pip install gast==0.3.3

 

참고로 gast는 generic Abstract Syntax Tree (AST)의 약자로 다양한 파이썬 버전들 사이에 양립할 수 있는 층 (compatibility layer)을 제공하는 라이브러리이다. 설치만 하면 별도의 import 없이 경고 메세지를 억제(suppress)해준다

 

Cheers!!

 

728x90
반응형

댓글