Hello! I runed this source code but I have an issue.
Traceback (most recent call last):
File "f:\studying\Artificial Intelligence\tensorflow\overimagination\bert\bert-master\run_classifier.py", line 25, in
import optimization
File "f:\studying\Artificial Intelligence\tensorflow\overimagination\bert\bert-master\optimization.py", line 87, in
class AdamWeightDecayOptimizer(tf.train.Optimizer):
AttributeError: module 'tensorflow._api.v2.train' has no attribute 'Optimizer'
Same here. Using Ubuntu 20.04, Python 3.8.2 and Tensorflow-GPU 2.3.0.
I'm having this error as well.
Does anyone have an idea to resolve this issue?
Thanks
I finally figured it out. It seems that the Optimizer class has been deprecated in the 2.x versions of Tensorflow. As this issue can attest, you will need to install an older version of Python too (I used 3.7). You can then run python3.7 -m pip install tensorflow-gpu==1.15.0 (or just tensorflow==1.15.0 for the CPU version) and you should have the correct version installed. That fixed it for me.
@miutamihai worked for me too
Hi, raised a PR #1155 to resolve this issue for tf versions greater than 2.0.
Thanks
Most helpful comment
I finally figured it out. It seems that the
Optimizerclass has been deprecated in the2.xversions of Tensorflow. As this issue can attest, you will need to install an older version ofPythontoo (I used3.7). You can then runpython3.7 -m pip install tensorflow-gpu==1.15.0(or justtensorflow==1.15.0for the CPU version) and you should have the correct version installed. That fixed it for me.