TensorFlow3 RuntimeError: Detected a call to `Model.predict` inside a `tf.function`. 파이썬 3.8에 tensorflow-gpu==2.9.0 버전을 사용하는 텐서플로우 환경에서 학습을 진행하는 도중 아래와 같은 오류가 발생했다. 오류메세지: RuntimeError: Detected a call to `Model.predict` inside a `tf.function`. `Model.predict is a high-level endpoint that manages its own `tf.function`. Please move the call to `Model.predict` outside of all enclosing `tf.function`s. Note that you can call a `Model` directly on `Tensor`s inside a `tf.function` lik.. 2024. 1. 4. Error occurred during the 1 iteration: Unable to serialize [2.0896919 2.1128857 2.1081853] to JSON. Unrecognized type <class 'tensorflow.python.framework.ops.EagerTensor'> 텐서플로우 환경에서 EfficientNetB1 모델을 사용해 학습을 진행하는데 아래와 같은 오류가 발생했다. 오류메세지: Error occurred during the 1 iteration: Unable to serialize [2.0896919 2.1128857 2.1081853] to JSON. Unrecognized type pip install tensorflow-gpu==2.10.0으로 설치하였고 tensorflow-gpu의 버전이 2.10.* 일 경우에 이런 오류가 난다. 따라서 pip uninstall tensorflow-gpu를 통해 제거해주고 2.9.0 버전으로 다시 설치하면 해결이 가능하다. 해결방법: pip install tensorflow-gpu==2.9.0 2024. 1. 3. 아나콘다 가상환경에서 tensorflow가 GPU를 인식하지 못할 때 GPU에 맞게 CUDA 및 cudnn을 다 설치하였을 때 아나콘다 가상환경에서 tensorflow-gpu가 설치되었는데도 GPU를 인식하지 못할때가 있다. from tensorflow.python.client import device_lib device_lib.list_local_devices() 를 통해 gpu가 인식되는지 확인할 수 있는데, gpu가 인식되지 않으면 아래의 사진처럼 CPU만 인식된다. tensorflow-gpu를 conda로 설치했을 때 위와 같은 오류가 나서 conda uninstall tensorflow-gpu -y 를 실행한 후 pip install tensorflow-gpu로 다시 설치했다. pip로 tensorflow-gpu를 다시 설치할 때 아래와 같은 오류가 발생했다. 그.. 2024. 1. 3. 이전 1 다음