tensor2tensor icon indicating copy to clipboard operation
tensor2tensor copied to clipboard

AttributeError: 'AdafactorOptimizer' object has no attribute 'get_gradients'

Open shizhediao opened this issue 3 years ago • 1 comments

Hi, When I am trying to reproduce the adafactor experiments on en-de translation task, I encountered the following issue. AttributeError: 'AdafactorOptimizer' object has no attribute 'get_gradients' Could any one tell me how to use adafactor optimizer? Below is my running code:

  --data_dir=t2t_data \
  --problem=translate_ende_wmt32k \
  --model=transformer \
  --hparams_set=transformer_base \
  --hparams="batch_size=1024,optimizer=adafactor" \
  --schedule=continuous_train_and_eval \
  --output_dir=translate_ende_wmt32k_adafactor \
  --train_steps=300000 \
  --worker_gpu=10 \
  --eval_steps=100

Thanks!

shizhediao avatar Nov 01 '22 08:11 shizhediao

fixed by commenting out line 241 and use line 245 https://github.com/tensorflow/tensor2tensor/blob/ef1fccebe8d2c0cf482f41f9d940e2938c816c78/tensor2tensor/utils/optimize.py#L241

shizhediao avatar Nov 01 '22 08:11 shizhediao