tensorflow / nmt

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

Failed run test example #78

Open cyzLoveDream opened 7 years ago

cyzLoveDream commented 7 years ago

Hello! I successfully downloaded training data from the official website, and when I trained the model in accordance with the instructions of the tutorial, such errors occurred: E:\transtate\nmt>python -m nmt.nmt \ --src=vi --tgt=en \ --vocab_prefix=E:\transtate\temp\nmt_data\vocab \ --train_prefix=E:\transtate\temp\nmt_data\train \ --dev_prefix=E:\transtate\temp\nmt_data\tst2012 \ --test_prefix=E:\transtate\temp\nmt_data\tst2013 \ --out_dir=E:\transtate\temp\nmt_data\nmt_model \ --num_train_steps=12000 \ --steps_per_stats=100 \ --num_layers=2 \ --num_units=128 \ --dropout=0.2 \ --metrics=bleu …… Traceback (most recent call last): File "D:\ProgramData\Anaconda3\envs\tensorflow\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "D:\ProgramData\Anaconda3\envs\tensorflow\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "E:\transtate\nmt\nmt\nmt.py", line 495, in tf.app.run(main=main, argv=[sys.argv[0]] + unparsed) File "D:\ProgramData\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "E:\transtate\nmt\nmt\nmt.py", line 488, in main run_main(FLAGS, default_hparams, train_fn, inference_fn) File "E:\transtate\nmt\nmt\nmt.py", line 481, in run_main train_fn(hparams, target_session=target_session) File "E:\transtate\nmt\nmt\train.py", line 329, in train sample_tgt_data) File "E:\transtate\nmt\nmt\train.py", line 248, in run_full_eval sample_src_data, sample_tgt_data) File "E:\transtate\nmt\nmt\train.py", line 162, in run_sample_decode infer_model.batch_size_placeholder, summary_writer) File "E:\transtate\nmt\nmt\train.py", line 529, in _sample_decode utils.print_out(" src: %s" % src_data[decode_id]) File "E:\transtate\nmt\nmt\utils\misc_utils.py", line 66, in print_out print(out_s, end="", file=sys.stdout) UnicodeEncodeError: 'gbk' codec can't encode character '\u1ebf' in position 11: illegal multibyte sequence Log display coding errors, where do I need to change to avoid such errors?Thanks

bingq commented 7 years ago

Are you running on Windows / CMD, as I am wondering this is because of your default codec is GBK ? If so, you can try type "chcp" in CMD and the result of 936 stands for GBK. You can type "chcp 65001" to switch to utf-8 and then re-run the example to see whether the error disappears.

"chcp 936" can switch back to GBK.

Just my 2 cents.

cyzLoveDream commented 7 years ago

oh, that's good for your answer. But i have meet another problem. I have successfully run the program, but the display in train_log is messy. How can I open the file "events.out.tfevents.1503486266.DESKTOP-K8L49U4" without messy. @bingq