bert icon indicating copy to clipboard operation
bert copied to clipboard

no attribute 'get_assigment_map_from_checkpoint'

Open JustinRong opened this issue 7 years ago • 5 comments

INFO:tensorflow:Error recorded from training_loop: 'module' object has no attribute 'get_assigment_map_from_checkpoint' INFO:tensorflow:training_loop marked as finished WARNING:tensorflow:Reraising captured error Traceback (most recent call last): File "run_scorer.py", line 759, in tf.app.run() File "/home/user/.local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "run_scorer.py", line 668, in main estimator.train(input_fn=train_input_fn, max_steps=num_train_steps) File "/home/user/.local/lib/python2.7/site-packages/tensorflow/contrib/tpu/python/tpu/tpu_estimator.py", line 2409, in train rendezvous.raise_errors() File "/home/user/.local/lib/python2.7/site-packages/tensorflow/contrib/tpu/python/tpu/error_handling.py", line 128, in raise_errors six.reraise(typ, value, traceback) File "/home/user/.local/lib/python2.7/site-packages/tensorflow/contrib/tpu/python/tpu/tpu_estimator.py", line 2403, in train saving_listeners=saving_listeners File "/home/user/.local/lib/python2.7/site-packages/tensorflow/python/estimator/estimator.py", line 354, in train loss = self._train_model(input_fn, hooks, saving_listeners) File "/home/user/.local/lib/python2.7/site-packages/tensorflow/python/estimator/estimator.py", line 1207, in _train_model return self._train_model_default(input_fn, hooks, saving_listeners) File "/home/user/.local/lib/python2.7/site-packages/tensorflow/python/estimator/estimator.py", line 1237, in _train_model_default features, labels, model_fn_lib.ModeKeys.TRAIN, self.config) File "/home/user/.local/lib/python2.7/site-packages/tensorflow/contrib/tpu/python/tpu/tpu_estimator.py", line 2195, in _call_model_fn features, labels, mode, config) File "/home/user/.local/lib/python2.7/site-packages/tensorflow/python/estimator/estimator.py", line 1195, in _call_model_fn model_fn_results = self._model_fn(features=features, **kwargs) File "/home/user/.local/lib/python2.7/site-packages/tensorflow/contrib/tpu/python/tpu/tpu_estimator.py", line 2479, in _model_fn features, labels, is_export_mode=is_export_mode) File "/home/user/.local/lib/python2.7/site-packages/tensorflow/contrib/tpu/python/tpu/tpu_estimator.py", line 1259, in call_without_tpu return self._call_model_fn(features, labels, is_export_mode=is_export_mode) File "/home/user/.local/lib/python2.7/site-packages/tensorflow/contrib/tpu/python/tpu/tpu_estimator.py", line 1533, in _call_model_fn estimator_spec = self._model_fn(features=features, **kwargs) File "run_scorer.py", line 445, in model_fn initialized_variable_names) = modeling.get_assigment_map_from_checkpoint( AttributeError: 'module' object has no attribute 'get_assigment_map_from_checkpoint'

JustinRong avatar Dec 14 '18 03:12 JustinRong

here is my file:

export BERT_BASE_DIR=/home/user/bert/uncased_L-12_H-768_A-12 
export GLUE_DIR=/home/user/bert/glue_data 

python run_scorer.py \ 
  --do_eval=true \ 
  --task_name=Sts \ 
  --do_train=true \ 
  --data_dir=$GLUE_DIR/STS-B \ 
  --vocab_file=$BERT_BASE_DIR/vocab.txt \ 
  --bert_config_file=$BERT_BASE_DIR/bert_config.json \ 
  --init_checkpoint=$BERT_BASE_DIR/bert_model.ckpt \ 
  --max_seq_length=128 \ 
  --train_batch_size=32 \ 
  --learning_rate=2e-5 \ 
  --num_train_epochs=3.0 \ 
  --output_dir=/home/user/bert/STS_output/

my tensorflow version :

>>> import tensorflow as tf
>>> print(tf.__version__)
1.12.0
>>> 

JustinRong avatar Dec 14 '18 04:12 JustinRong

i use this python file: run_scorer.py

JustinRong avatar Dec 14 '18 04:12 JustinRong

There was a typo in the original function fname, change it to assignment (with an n after the g)

On Thu, Dec 13, 2018 at 8:06 PM JustinRong [email protected] wrote:

i use this python file:

https://github.com/Colanim/BERT_STS-B/blob/master/run_scorer.py

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/google-research/bert/issues/267#issuecomment-447206692, or mute the thread https://github.com/notifications/unsubscribe-auth/AqbD3qaUAUtNsAll-aJHYKFZLpOAc4G4ks5u4yPAgaJpZM4ZS2FT .

jacobdevlin-google avatar Dec 14 '18 05:12 jacobdevlin-google

@jacobdevlin-google It works, thank you

JustinRong avatar Dec 14 '18 07:12 JustinRong

Hi

I see there is no task added for the QQP Bert model. I have added QQP processor in both "run_classifier.py" and "run_classifier_with_tfhub.py" along with the class "class QqpProcessor(DataProcessor):" in run_classifier.py file. I see my tf version is higher than 1.12.0 which is 1.15.0 and in TPU I added the below lines to incorperate QQP task to include QQP processor.

processors = { "cola": run_classifier.ColaProcessor, "mnli": run_classifier.MnliProcessor, "mrpc": run_classifier.MrpcProcessor, "qqp": run_classifier.QqpProcessor, }

but still I am getting attribute error

AttributeError: module 'run_classifier' has no attribute 'QqpProcessor'

kindly advice. Do I need to change any where else to include QQP task?

Jithen2110 avatar Nov 03 '19 15:11 Jithen2110