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.59k stars 3.51k forks source link

checkpoint_path AttributeError during exporting #1193

Open KayShenClarivate opened 6 years ago

KayShenClarivate commented 6 years ago

Description

I am trying to use t2t-exporter to export a specific checkpoint. I set checkpoint_path, but when i ran t2t-exporter, it complains AttributeError.

t2t-exporter \
  --data_dir=$DATA_DIR \
  --checkpoint_path=$TRAIN_DIR\/model.ckpt-251001 \
  --problem=$PROBLEM \
  --model=$MODEL \
  --hparams_set=$HPARAMS \
  --t2t_usr_dir=$USR_DIR

INFO:tensorflow:Importing user module train_mat_adv from path /models Traceback (most recent call last): File "/home/ubuntu/tensorflow/bin/t2t-exporter", line 16, in tf.app.run() File "/home/ubuntu/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 126, in run _sys.exit(main(argv)) File "/home/ubuntu/tensorflow/bin/t2t-exporter", line 12, in main export.main(argv) File "/home/ubuntu/tensorflow/local/lib/python2.7/site-packages/tensor2tensor/serving/export.py", line 59, in main run_config = t2t_trainer.create_run_config(hparams) File "/home/ubuntu/tensorflow/local/lib/python2.7/site-packages/tensor2tensor/bin/t2t_trainer.py", line 189, in create_run_config assert FLAGS.output_dir or FLAGS.checkpoint_path File "/home/ubuntu/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/platform/flags.py", line 85, in getattr return wrapped.getattr(name) File "/home/ubuntu/tensorflow/local/lib/python2.7/site-packages/absl/flags/_flagvalues.py", line 470, in getattr raise AttributeError(name) AttributeError: checkpoint_path

KayShenClarivate commented 6 years ago

the "--export_dir" option also does not work.

lkluo commented 6 years ago

The value of checkpoint_path input was inappropriate. Try $TRAIN_DIR/model.ckpt-251001 instead.

KayShenClarivate commented 6 years ago

The value of checkpoint_path input was inappropriate. Try $TRAIN_DIR/model.ckpt-251001 instead.

Tried and not worked.

lkluo commented 6 years ago

Just noted that you was using t2t-exporter command, in which --checkpoint_path shall not work. I suggest you use --output_d=$TRAIN_DIR instead (the checkpoint 251001 should be in the first line of you checkpoint file). This should fix your problem.

KayShenClarivate commented 6 years ago

Just noted that you was using t2t-exporter command, in which --checkpoint_path shall not work. I suggest you use --output_d=$TRAIN_DIR instead (the checkpoint 251001 should be in the first line of you checkpoint file). This should fix your problem.

I see. Thanks! How about --export_dir? I wanted to export the model to a certain directory.

lkluo commented 6 years ago

--export_dir does not function either, see also #1082. I don't know if the latest t2t has fixed this. You may try it.

KayShenClarivate commented 6 years ago

--export_dir does not function either, see also #1082. I don't know if the latest t2t has fixed this. You may try it.

i see. Thanks!