Using master branch of cleverhans with TF2.2

281 views Asked by At

In the pull requests, I see that master branch has code which works with TF2. I am looking into how to use them. I use a conda env with python 3.7.7 and tf 2.2. Then I pulled master branch from gihub celverhans. But, when I try to run mnist_tutorial_tfe.py, I get the following error.

$ python ./cleverhans_tutorials/mnist_tutorial_tfe.py 
Traceback (most recent call last):
  File "./cleverhans_tutorials/mnist_tutorial_tfe.py", line 23, in <module>
    from cleverhans.utils_tfe import train, model_eval
  File "/media/Y/vish/hcraeser/code_repo/cleverhans/cleverhans/utils_tfe.py", line 17, in <module>
    from cleverhans.loss import LossCrossEntropy
  File "/media/Y/vish/hcraeser/code_repo/cleverhans/cleverhans/loss.py", line 10, in <module>
    from cleverhans.attacks import Attack
  File "/media/Y/vish/hcraeser/code_repo/cleverhans/cleverhans/attacks/__init__.py", line 12, in <module>
    from cleverhans.attacks.attack import Attack
  File "/media/Y/vish/hcraeser/code_repo/cleverhans/cleverhans/attacks/attack.py", line 13, in <module>
    from cleverhans.model import Model
  File "/media/Y/vish/hcraeser/code_repo/cleverhans/cleverhans/model.py", line 9, in <module>
    from cleverhans import utils_tf
  File "/media/Y/vish/hcraeser/code_repo/cleverhans/cleverhans/utils_tf.py", line 345, in <module>
    loss_collection=tf.GraphKeys.REGULARIZATION_LOSSES):
AttributeError: module 'tensorflow' has no attribute 'GraphKeys'

How can I use cleverhans with TF2? It seems the relevant code is under cleverhans/future directory. But how to make these official examples run under TF2?

0

There are 0 answers