lvapeab / nmt-keras

Neural Machine Translation with Keras
http://nmt-keras.readthedocs.io
MIT License
533 stars 130 forks source link

Unicode Errors while ensemble decoding #105

Closed VP007-py closed 4 years ago

VP007-py commented 4 years ago

I am getting this log when I try to decode via a GPU process

However I have the target language translations generated well if I run it from the console

Sampling 499/500  -  ETA: 94s 
Sampling 500/500  -  ETA: 47s 

Total cost of the translations: 12578.379883     Average cost of the translations: 25.156759

The sampling took: 23531.073617 secs (Speed: 47.062147 sec/sample)
Traceback (most recent call last):
  File "sample_ensemble.py", line 62, in <module>
    sample_ensemble(args, params)
  File "/home/vinay737/nmt-keras/nmt_keras/apply_model.py", line 156, in sample_ensemble
    list2stdout(predictions)
  File "/home/vinay737/nmt-keras/src/keras-wrapper/keras_wrapper/extra/read_write.py", line 135, in list2stdout
    print (mylist)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
VP007-py commented 4 years ago

@lvapeab please consider updating /src/keras-wrapper/keras_wrapper/extra/read_write.py to print(mylist.encode('utf-8')) or other encoding formats. It works now

Maybe Update It in the config.py as well ?