tensorflow / tensor2tensor

Library of deep learning models and datasets designed to make deep learning more accessible and accelerate ML research.
Apache License 2.0
15.6k stars 3.51k forks source link

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

Open shizhediao opened 2 years ago

shizhediao commented 2 years ago

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 commented 2 years ago

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