google-research / google-research

Google Research
https://research.google
Apache License 2.0
34.3k stars 7.92k forks source link

Tabnet requirements.txt outdated due to old tf version? module 'tensorflow.compat.v1' has no attribute 'contrib' when running experiment_covertype #204

Open NataliaDiaz opened 4 years ago

NataliaDiaz commented 4 years ago

Hi, Running the second instruction in the readme (should be python -m experiment_covertype - without the .py), I get the error:

W0225 10:16:24.084449 140481427662656 ag_logging.py:145] Entity <bound method BatchNormalization.call of <tensorflow.python.layers.normalization.BatchNormalization object at 0x7fc40296fd90>> could not be transformed and will be executed as-is. Please report this to the AutgoGraph team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output. Cause: converting <bound method BatchNormalization.call of <tensorflow.python.layers.normalization.BatchNormalization object at 0x7fc40296fd90>>: AssertionError: Bad argument number for Name: 3, expecting 4
Traceback (most recent call last):
  File "/home/natalia/anaconda3/envs/tabnet/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/natalia/anaconda3/envs/tabnet/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/natalia/repos/google-research/tabnet/experiment_covertype.py", line 200, in <module>
    app.run(main)
  File "/home/natalia/anaconda3/envs/tabnet/lib/python3.7/site-packages/absl/app.py", line 299, in run
    _run_main(main, args)
  File "/home/natalia/anaconda3/envs/tabnet/lib/python3.7/site-packages/absl/app.py", line 250, in _run_main
    sys.exit(main(argv))
  File "/home/natalia/repos/google-research/tabnet/experiment_covertype.py", line 99, in main
    feature_train_batch, reuse=False, is_training=True)
  File "/home/natalia/repos/google-research/tabnet/tabnet_model.py", line 201, in encoder
    mask_values = tf.contrib.sparsemax.sparsemax(mask_values)
AttributeError: module 'tensorflow.compat.v1' has no attribute 'contrib'
dynamicwebpaige commented 4 years ago

Hi, @NataliaDiaz! tf.contrib has been removed from TensorFlow 2.0, but sparsemax has been added to the TensorFlow Addons package. Could you try swapping out the symbol names, and seeing if the tensorflow_addons equivalent works for you?

shubhamnagalwade commented 4 years ago

@dynamicwebpaige which version can i used.