apeterswu / RL4NMT

Reinforcement Learning for Neural Machine Translation
187 stars 48 forks source link

a few questions #1

Closed connectdotz closed 5 years ago

connectdotz commented 6 years ago

First of all, thanks for putting this repo up, we enjoy your paper and would like to reproduce it in our lab. Have a few questions:

  1. is this repo complete? I see only training scripts, not sure how the data is generated. And not sure if I find the RL models and how they are integrated... maybe I am missing something?
  2. I see you have a complete tensor2tensor source code copied in this repo instead of referencing to the t2t official package. Does this mean you have changed t2t code base in some way? or we can safely use t2t official package (perhaps with an older version)?
  3. Would really appreciate if you can provide a more detailed example on how to produce the unified model (zhen_bi_src_tgt_mono) from this code base.
apeterswu commented 6 years ago

Thanks for your interesting. Due to some busy stuff, I will respond to you later in detail. In a short: 1.) I will upload a script to convert the model. 2). Yes, the code is an earlier version based on t2t-1.2.9.

belomeriem commented 6 years ago

Hi, Thanks for the paper and for the code here, nice work! As a follow-up question to @connectdotz, I couldn't find the code to the RL part, are you planning to upload that part as well (or am I missing something)? Thanks a lot!

apeterswu commented 6 years ago

@belomeriem @connectdotz Thanks for your interest. Please check the relevance part of https://github.com/apeterswu/RL4NMT/blob/master/tensor2tensor/utils/model_builder.py#L132 This is about the RL model training.

apeterswu commented 6 years ago

@connectdotz For the data generation, it is same as inference phase, you can check the original t2t code base on how to inference. If you meet problems, please response again. For the last question, you can do the unified training process in an easy way like this: 1. Generate translations for source and target monolingual data as described in the paper, and tarin the MLE model. 2. Use the MLE model to further train the RL part with combined three part data: bilingual data pair, source monolingual data and its translation, back-translated source data of the target monolingual data and the target monolingual data itself.

Kailianghu commented 4 years ago

hello, i have run the bash script : bash train_zhen.sh . there has an error Instructions for updating: Use tf.estimator.train_and_evaluate. WARNING:tensorflow:RunConfig.uid (from tensorflow.contrib.learn.python.learn.estimators.run_config) is experimental and may change or be removed at any time, and without warning. INFO:tensorflow:Creating experiment, storing model files in ./model/zhen_wmt17_transformer_rl_delta_setting INFO:tensorflow:Loading and processing source vocabulary from: vocab.src Traceback (most recent call last): File "./tensor2tensor/bin/t2t-trainer", line 96, in tf.app.run() File "/Users/dwing/anaconda3/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "./tensor2tensor/bin/t2t-trainer", line 92, in main schedule=FLAGS.schedule) File "/Users/dwing/Downloads/RL4NMT-master/tensor2tensor/utils/trainer_utils.py", line 393, in run hparams=hparams) File "/Users/dwing/anaconda3/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 324, in new_func return func(*args, **kwargs) File "/Users/dwing/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/learn_runner.py", line 208, in run experiment = wrapped_experiment_fn(run_config=run_config, hparams=hparams) File "/Users/dwing/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/learn_runner.py", line 85, in wrapped_experiment_fn experiment = experiment_fn(run_config, hparams) File "/Users/dwing/Downloads/RL4NMT-master/tensor2tensor/utils/trainer_utils.py", line 145, in experiment_fn run_config=run_config) File "/Users/dwing/Downloads/RL4NMT-master/tensor2tensor/utils/trainer_utils.py", line 157, in create_experiment run_config=run_config) # input_fns: input_function File "/Users/dwing/Downloads/RL4NMT-master/tensor2tensor/utils/trainer_utils.py", line 220, in create_experiment_components add_problem_hparams(hparams, FLAGS.problems) File "/Users/dwing/Downloads/RL4NMT-master/tensor2tensor/utils/trainer_utils.py", line 284, in add_problem_hparams p_hparams = problem.get_hparams(hparams) # contains vocabulary, inputs/targets modality File "/Users/dwing/Downloads/RL4NMT-master/tensor2tensor/data_generators/problem.py", line 293, in get_hparams self.get_feature_encoders(data_dir) # vocabulary File "/Users/dwing/Downloads/RL4NMT-master/tensor2tensor/data_generators/problem.py", line 283, in get_feature_encoders self._encoders = self.feature_encoders(data_dir) File "./zhen_wmt17/zhen_wmt17.py", line 142, in feature_encoders with open(os.path.join(data_dir,_ZHEN_VOCAB_FILES[0]), 'rb') as f: FileNotFoundError: [Errno 2] No such file or directory: '../transformer_data/zhen/vocab.src'

i want to ask how to generation data and where is. transformer_data directory