AttributeError: module 'tensorflow' has no attribute 'compat' when loading tf.compat.v1.train.SessionRunHook

前端 未结 4 428
别跟我提以往
别跟我提以往 2020-12-31 11:46

I can see that this question has been asked before here tensorflow-has-no-attribute-compat

but the answer given was to

Microsoft Visual C++ 2015-2019 R         


        
相关标签:
4条回答
  • 2020-12-31 12:23

    This is usually caused by the broken TensorFlow-estimator module.

    simply do a

    pip install tensorflow-estimator==2.1.*
    
    0 讨论(0)
  • 2020-12-31 12:35

    the specs you have given are correct

    tensorflow-gpu 2.1

    python 3.7.7

    CUDA 10.1

    Anaconda 3.7

    but in tensorflow 2.X first install

    pip install tensorflow-estimator==2.1.*
    

    then install

    pip install tensorflow-gpu 
    

    and then run the following command to check the number of gpu

    import tensorflow as tf
    print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))
    

    i hope it will work

    0 讨论(0)
  • 2020-12-31 12:36

    Special note for Conda users:

    When one enters conda install tensorflow it installs 2.1.0 but it brings with it tensorflow-estimator 2.2.0. To fix this problem simply run conda install tensorflow-estimator==2.1.0 after installing tensorflow 2.1.0 in Conda.

    This advice is valid until conda switches to TF 2.2.0 (or better yet to 2.3.0)

    credits to this TF github thread

    UPDATE: as of 10-Dec-2020 Conda has TF 2.3.0 for Windows and 2.2.0 for Linux. Check here to see current state of TF support in Conda.

    0 讨论(0)
  • 2020-12-31 12:45

    Below solution worked for me. Reference

    First install Estimator=2.1 then the rest:

    conda remove tensorflow
    conda install tensorflow-estimator 2.1
    conda install tensorflow-gpu=2.1
    
    0 讨论(0)
提交回复
热议问题