bert icon indicating copy to clipboard operation
bert copied to clipboard

I get attribute error when I run classifier code

Open zhuchenxi opened this issue 8 years ago • 12 comments

When I run code like: python run_classifier.py
--task_name=MRPC
--do_train=true
--do_eval=true
--data_dir=SST-2
--vocab_file=english_L-12_H-768_A-12/vocab.txt
--bert_config_file=english_L-12_H-768_A-12/bert_config.json
--init_checkpoint=english_L-12_H-768_A-12/bert_model.ckpt
--max_seq_length=128
--train_batch_size=32
--learning_rate=2e-5
--num_train_epochs=3.0
--output_dir=output

I get an Attribute Error as following: Traceback (most recent call last): File "run_classifier.py", line 754, in tf.app.run() File "/home/xiyu/.local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "run_classifier.py", line 658, in main is_per_host = tf.contrib.tpu.InputPipelineConfig.PER_HOST_V2 AttributeError: 'module' object has no attribute 'InputPipelineConfig'

My tensorflow version is 1.4.0, and my gpu is GTX1080. Do I run the shell wrong or I forget to install some packages?

Thanks very much.

zhuchenxi avatar Nov 05 '18 10:11 zhuchenxi

update your tensorflow to 1.11

wykdg avatar Nov 05 '18 11:11 wykdg

Yes, BERT requires TF 1.11 (or maybe 1.10 would work, but nothing earlier).

jacobdevlin-google avatar Nov 05 '18 19:11 jacobdevlin-google

@jacobdevlin-google Thanks, use tf 1.11 docker, and it works.

zhuchenxi avatar Feb 01 '19 03:02 zhuchenxi

AttributeError: module 'tensorflow.contrib.tpu' has no attribute 'outside_compilation' help pleaseee

jaregauri avatar Oct 26 '19 15:10 jaregauri

I have the same error "outside_compilation". did you solve it?

hasansalimkanmaz avatar Nov 20 '19 13:11 hasansalimkanmaz

I have the same error "outside_compilation". did you solve it?

Yes, just update your tensorflow to 1.11

zhuchenxi avatar Dec 05 '19 06:12 zhuchenxi

I have the same issue on is_per_host = tf.contrib.tpu.InputPipelineConfig.PER_HOST_V2. Now that TF is updated to 2.1.0 and tf.contrib has been removed since TF2. What do I do with this? (Suppose I do not wish to downgrade to TF1.x)

dibery avatar Feb 05 '20 09:02 dibery

I have the same issue on is_per_host = tf.contrib.tpu.InputPipelineConfig.PER_HOST_V2. Now that TF is updated to 2.1.0 and tf.contrib has been removed since TF2. What do I do with this? (Suppose I do not wish to downgrade to TF1.x)

i dont want to downgrade my tf too, but it seems no way

michaelearncoding avatar Mar 13 '20 13:03 michaelearncoding

Instead of using is_per_host = tf.contrib.tpu.InputPipelineConfig.PER_HOST_V2, please use is_per_host = tf.compat.v1.estimator.tpu.InputPipelineConfig.PER_HOST_V2

Hope this helps!!

Aaina-bajaj avatar May 11 '20 05:05 Aaina-bajaj

Instead of using is_per_host = tf.contrib.tpu.InputPipelineConfig.PER_HOST_V2, please use is_per_host = tf.compat.v1.estimator.tpu.InputPipelineConfig.PER_HOST_V2

Hope this helps!!

it not works, my tf version is 1.8.0, any other ways can help in the condition of not downgrading to tf1.0?

Gavingx avatar Oct 16 '20 05:10 Gavingx

Instead of using is_per_host = tf.contrib.tpu.InputPipelineConfig.PER_HOST_V2, please use is_per_host = tf.compat.v1.estimator.tpu.InputPipelineConfig.PER_HOST_V2 Hope this helps!!

it not works, my tf version is 1.8.0, any other ways can help in the condition of not downgrading to tf1.0?

TF 1.8? Then you should UPgrade to TF 1.11+. That's for TF 2+. (See discussion above.)

dibery avatar Oct 16 '20 06:10 dibery

Instead of using is_per_host = tf.contrib.tpu.InputPipelineConfig.PER_HOST_V2, please use is_per_host = tf.compat.v1.estimator.tpu.InputPipelineConfig.PER_HOST_V2 Hope this helps!!

it not works, my tf version is 1.8.0, any other ways can help in the condition of not downgrading to tf1.0?

TF 1.8? Then you should UPgrade to TF 1.11+. That's for TF 2+. (See discussion above.)

Ok, I'll try, thanks

Gavingx avatar Oct 16 '20 06:10 Gavingx