martin-gorner / tensorflow-rnn-shakespeare

Code from the "Tensorflow and deep learning - without a PhD, Part 2" session on Recurrent Neural Networks.
Apache License 2.0
534 stars 249 forks source link

Encoding Issue while training #15

Closed GermanGoGo closed 6 years ago

GermanGoGo commented 7 years ago

Hello Martin thanks a lot for the awesome videos and resources.

Currently I get my train file to run, and pick up the books. However, when printing what it has read so far it snaps out of it with the following error:

Traceback (most recent call last): File "C:\Users\Pc\Desktop\ensorflow-rnn-shakespeare-master\rnn_train.py", line 150, in txt.print_learning_learned_comparison(x, y, l, bookranges, bl, acc, epoch_size, step, epoch) File "C:\Users\Pc\Desktop\ensorflow-rnn-shakespeare-master\my_txtutils.py", line 175, in print_learning_learned_comparison print(footer) File "C:\Users\Pc\AppData\Local\Programs\Python\Python36\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-7: character maps to

Can you please give me a had to clear this up and continue learning this awesome content!

German G

hcchengithub commented 7 years ago

I wish I can help you. No problem here on my computer see my DOS Box shell dump --> http://note.youdao.com/noteshare?id=57eeb3d8d7909ba6dea7c1502ff13545

python3.6, tensorflow 1.1 ... please check the Windows 10, i7 CPU without GPU. Let me know if I can be of any further assistance.

My problem is: I can't understand what this RNN Tutorial is for. The network trained with shakespeare's books and what? Part 1 MNIST image recognition is clear to me, besides. Drop me some hints if you can. Thank you very much!!

martin-gorner commented 7 years ago

@hcchengithub this model is a "language model". It predicts probabilities for the next character with a distribution similar to what you would find in the Shakespeare corpus. In itself, it is just for fun. Or you could call it an academic interest. But more useful models can be extrapolated from language models, like translation models or models that generate image captions. I explore some of them in this video: https://youtu.be/pzOzmxCR37I

hcchengithub commented 7 years ago

Thank you so much Sir!