tensorflow / benchmarks

A benchmark framework for Tensorflow
Apache License 2.0
1.14k stars 630 forks source link

ImportError: cannot import name multi_device_iterator_ops #513

Closed tot0rokr closed 3 years ago

tot0rokr commented 3 years ago

I used the script: python benchmarks/scripts/tf_cnn_benchmarks/tf_cnn_benchmarks.py --num_gpus=1 --batch_size=32 --model=resnet50 --variable_update=parameter_server

But I got an import error.

Traceback (most recent call last):
  File "benchmarks/scripts/tf_cnn_benchmarks/tf_cnn_benchmarks.py", line 29, in <module>
    import benchmark_cnn
  File "/root/benchmarks/scripts/tf_cnn_benchmarks/benchmark_cnn.py", line 45, in <module>
    import datasets
  File "/root/benchmarks/scripts/tf_cnn_benchmarks/datasets.py", line 32, in <module>
    import preprocessing
  File "/root/benchmarks/scripts/tf_cnn_benchmarks/preprocessing.py", line 29, in <module>
    from tensorflow.python.data.ops import multi_device_iterator_ops
ImportError: cannot import name multi_device_iterator_ops

In my environment, tensorflow v1.6.0 runs on a nvidia-docker with python2.7 + cuda 9.0 + cudnn 7.0. And the machine has GTX1050 with NVIDIA driver 460. I modified all import tensorflow.compat.v1 as tf to import tensorflow as tf because of another import error.

I followed #197. But I could not solve it. I tried https://github.com/reedwm/benchmarks/tree/num_steps_issue mentioned in #197. I got another import error.

Traceback (most recent call last):
  File "bens/scripts/tf_cnn_benchmarks/tf_cnn_benchmarks.py", line 27, in <module>
    import benchmark_cnn
  File "/root/bens/scripts/tf_cnn_benchmarks/benchmark_cnn.py", line 40, in <module>
    import data_utils
  File "/root/bens/scripts/tf_cnn_benchmarks/data_utils.py", line 24, in <module>
    from tensorflow.contrib.data.python.ops import threadpool
ImportError: cannot import name threadpool

bens is the ropository

Thank you.

tot0rokr commented 3 years ago

My mistake. I should run on "cnn_tf_v1.5_compatible" branch but ran on "master" branch.