-
Notifications
You must be signed in to change notification settings - Fork 9.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
module 'tensorflow_core._api.v2.train' has no attribute 'Optimizer' #934
Comments
I met the same problem with tensorflow 1.15.0. |
same issue here! |
Same issue. |
same issue |
It became a warning instead with the 1.14 version. |
Same issue with Tensorflow cpu 2.0.0 on mac ! |
Same issue. |
change tensorflow version to 1.14 |
change |
This is going to become more prevalent as more users switch to TensorFlow 2. I would suggest that the developers start a new branch for TensorFlow 2 development. As more people switch, that branch can eventually become master. Might want to tag a final release based on TensorFlow 1 or something before cutting over. |
I am experiencing this as I am trying to execute a model in a new environment using Tensorflow 2.0, and GPU. |
People who are starting new projects are going to use tensorflow 2, is there a place or way to get this working with tf2. Probably a beta version which works with tf2 without errors |
Someone have a solution? I'm trying to follows thi tutorial: |
There is a now BERT 2.x tutorial (runs TF 2.1) at https://cloud.google.com/tpu/docs/tutorials. |
That's good I guess, but, unless I'm missing something (which I totally could be) it really doesn't solve the issue that the code in this repo won't work with TF 2 right? |
Right, this code needs TF 1.15. I was responding to girottoma's comment above. In https://github.com/google-research/bert/blob/master/README.md, there is a section "Fine-tuning with Cloud TPUs" that references the Cloud TPU BERT tutorial (there are now 2 of them) and a BERT colab at https://cloud.google.com/tpu/docs/tutorials/. The BERT 2.x tutorial uses TF 2.1 and the BERT 1.x tutorial uses TF 1.1.5 (this tutorial was broken, but will be fixed and republished next week). |
Haha! My fault. I knew I was missing something. 🤤 Thanks for clarification. |
There was a problem with the TF 1.15 BERT tutorial (https://cloud.google.com/tpu/docs/tutorials/bert) that was causing it to fail. It has been fixed and the BERT 1.x tutorial should run correctly now. |
Hey guys,i think i got the same issue cause i'm using tensorflow-gpu 1.15.0 and tensorflow 1.15.0 but when i train into the dataset of SQUAD i got Anyone has a clue ? |
same issue using google colab |
I fixed the issue in google colab by installing tensorflow 1.15 instead of 2. I get a warning only. |
I am also facing the same issue --AttributeError Traceback (most recent call last) ~\bert\run_classifier.py in ~\bert\optimization.py in AttributeError: module 'tensorflow._api.v2.train' has no attribute 'Optimizer' |
Hi, Did you get a reply on how to solve this issue? |
This can be solved by changing tf.train.Optimizer to tf.compat.v1.train.AdamOptimizer() |
just in case this helps someone: one thing that has helped me solve this issue is to ensure my python==2.x (note: not 3.x which is default these days), tensorflow==1.15.0 |
Got the error below after making the above changes. Traceback (most recent call last): Triggered a bunch of other function errors after changing flags = tf.flags to tf.compat.v1.flags. So went ahead made the following global change, which is probably equivalent to setting tf version to 1.15.0. tf = tensorflow.compat.v1 Then the following error occurred. (The same error happens when setting tf version to 1.15.) AttributeError: module 'bert.tokenization' has no attribute 'validate_case_matches_checkpoint' Seems bert.tokenization does have this function defined though. Any thoughts how to fix? |
this could work!! |
I have same problem |
class AdamWeightDecayOptimizer(tf.compat.v1.train.Optimizer): |
Just change the code from |
I've tried jumping through the hoops of trying to make things work with python3, but was ultimately unsuccessful. So I opted to just use python2 (2.7.18) and updating the requirements.txt file to be
Despite seeing some warnings, I currently have the classifier running. |
problem solved! thank you |
Traceback (most recent call last):
File "run_classifier.py", line 25, in
import optimization
File "D:\bertpro\bert\optimization.py", line 87, in
class AdamWeightDecayOptimizer(tf.train.Optimizer):
AttributeError: module 'tensorflow_core._api.v2.train' has no attribute 'Optimizer'
The text was updated successfully, but these errors were encountered: