robbiebarrat / rapping-neural-network

Rap song writing recurrent neural network trained on Kanye West's entire discography
1.04k stars 167 forks source link

Unicode decode error #16

Closed bensdm closed 6 years ago

bensdm commented 6 years ago

Hi, Great job, i am trying to generate raps with default kanye lines but i have the following error: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 42992: character maps to

thanks for your help

robbiebarrat commented 6 years ago

Could you please paste in the full error message? I think I've ran into something similar before...

bensdm commented 6 years ago

File "C:\Anaconda3\envs\tensorflow\lib\encodings\cp1252.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 4299 2: character maps to

thanks

robbiebarrat commented 6 years ago

Are you on a mac? Also "Anaconda3" - are you using python 3? If so, please switch to 2.7.

Assuming you're on python 2.7 - you could try adding the encoding="utf8" argument to all of the parts where files are open()ed - like file = open(filename, encoding="utf8", "r")

bensdm commented 6 years ago

thanks for your response, now i've the following error: reverselist = sorted(reverselist) TypeError: '<' not supported between instances of 'bytes' and 'str'

bensdm commented 6 years ago

i am on windows and cant install tensorflow with python 2.7 on windows...

it seems that my error comes from the fact that rhyme function sometimes return None

i finaly fix my issue, just needed to delete rhymeslist = [x.encode('UTF8') for x in rhymeslist]

Just a last question, the rhymes and syllables are supposed to remain the same during the whole rap?

robbiebarrat commented 6 years ago

Sorry for the delay in response; glad you got it fixed. Sometimes the "remain the same during the whole rap" thing happens; but not a large percentage of the time.