tensorflow / nmt

TensorFlow Neural Machine Translation Tutorial
Apache License 2.0
6.36k stars 1.96k forks source link

How to use the --ckpt command to restore model #352

Closed yapingzhao closed 6 years ago

yapingzhao commented 6 years ago

Hi, I have a question: how can we train the model, so that it initializes the weights using the values from the checkpoint? In other words how do I fine-tune the model for a new dataset. In the train.py file "_with train_model.graph.as_default():      Loaded_train_model, global_step = model_helper.create_or_load_model(          Train_model.model, model_dir, trainsess, "train")" The above content is modified to the following: "_with tf.Session() as sess:      New_saver=tf.train.import_meta_graph('checkpoint_dir/MyModel-1000.meta')       New_saver.restore(sess,tf.train.latest_checkpoint('checkpointdir')" I am newbie of nmt.I do not know where there is a problem with the above method. In the end, I failed. I hope you can provide some suggestions. Looking forward to your advice or answers. Best regards, Thank you very much!