rfbr / PDR_with_Deep_Learning

40 stars 12 forks source link

Improper nesting of variable_scope #1

Open yifan16 opened 3 years ago

yifan16 commented 3 years ago

Hello, I tried to run the code but encountered several problems.

  1. When using the listed environment (TensorFlow1.14.0, Cuda 10.0,.etc), I met an error (TensorFlow1.15.0 also has the same error): "OpHint dynamic rnn only supports control flow v2."
  2. I then checked that "tf.compat.v1.lite.experimental.nn.dynamic_rnn" is available for TensorFlow 2.4.0, so I upgraded to TensorFlow 2.0.0 and 2.4.0, I met another error: "could not load dynamic library 'libcudnn.so.8'; dlerror: libcudnn.so.8: cannot open shared object file: no such file or directory"
  3. I then installed cudnn 8.0 and then I met the error: "Exception RuntimeError occurred, arguments: ('Improper nesting of variable_scope.',)"
  4. Besides, I tried CUDA10.0, CUDA10.1, CUDA11.0 and got the same results. Also, I tried to install from pip and conda and got the same results. FYI. Could you please help? Many thanks!
rfbr commented 2 years ago

Hello @yifan16! I remember having the same error and that's why I added the following line in the __main__ script:

os.environ['TF_ENABLE_CONTROL_FLOW_V2'] = '1'

I hope it's the answer you were looking for (and sorry for the delay!).

YuRuiii commented 1 year ago

I run into the same problem today, with os.environ['TF_ENABLE_CONTROL_FLOW_V2'] = '1' in __main__.py. Could you help with that? Thanks.