问题
I'm am getting this error just in the being of importing my packages. I haven't been able to find the correct remedy to fix the issue. Any help is greatly appreciated.
From what I can tell it looks to maybe be a Tensorflow issue?
from sklearn.model_selection import train_test_split
import pandas as pd
import tensorflow as tf
import tensorflow_hub as hub
from datetime import datetime
import bert
from bert import run_classifier
from bert import optimization
from bert import tokenization
回答1:
You seem to have TensorFlow 2.x
while the bert
module uses TensorFlow 1.x
. You can verify here that Tensorflow 1.x
has the tf.train.Optimizer
module while according to this, Tensorflow 2.x
has no such module.
Make sure you install the Tensorflow
version that bert
requires
来源:https://stackoverflow.com/questions/60835983/attributeerror-module-tensorflow-core-api-v2-train-has-no-attribute-optimiz