[FIXED] need to import tensorflow_hub

Issue

I am getting below error while trying to import tensorflow_hub. I have applied the already available solutions on Github or on stackoverflow and even downgraded my tesnorflow and estimator too. Still I am getting below. Can you please help ?

ImportError: cannot import name 'dnn_logit_fn_builder' from partially initialized module 'tensorflow_estimator.python.estimator.canned.dnn' (most likely due to a circular import) (C:\Users\kumar\anaconda3\lib\site-packages\tensorflow_estimator\python\estimator\canned\dnn.py)

code –

import tensorflow as tf
from tensorflow_estimator.python.estimator.canned.dnn import dnn_logit_fn_builder
import tensorflow_hub as hub

Solution

Given code worked fine with Tf v2.8 and v2.9.1

import tensorflow as tf
from tensorflow_estimator.python.estimator.canned.dnn import dnn_logit_fn_builder
import tensorflow_hub as hub

Answered By – TFer

Answer Checked By – Marie Seifert (Easybugfix Admin)

Leave a Reply

(*) Required, Your email will not be published