maxpumperla / hyperas

Keras + Hyperopt: A very simple wrapper for convenient hyperparameter optimization
http://maxpumperla.com/hyperas/
MIT License
2.18k stars 318 forks source link

UnicodeDecodeError: 'gbk' codec can't decode byte 0xa2 in position 885: illegal multibyte sequence #279

Closed wenjuanxu closed 4 years ago

wenjuanxu commented 4 years ago

Traceback (most recent call last): File "E:/课题组工作/高铁项目/程序/LSTM多分类/LSTM_BO_g34.py", line 103, in trials=Trials()) File "D:\Python\Python35\lib\site-packages\hyperas\optim.py", line 69, in minimize keep_temp=keep_temp) File "D:\Python\Python35\lib\site-packages\hyperas\optim.py", line 98, in base_minimizer model_str = get_hyperopt_model_string(model, data, functions, notebook_name, verbose, stack) File "D:\Python\Python35\lib\site-packages\hyperas\optim.py", line 186, in get_hyperopt_model_string source = f.read() UnicodeDecodeError: 'gbk' codec can't decode byte 0xa2 in position 885: illegal multibyte sequence

JonnoFTW commented 4 years ago

This is likely because you have some chinese characters in your code. Consider removing them. A potential fix would involve changing this line:

https://github.com/maxpumperla/hyperas/blob/master/hyperas/optim.py#L188

to:

with open(calling_script_file, 'r', encoding='utf-8') as f
wenjuanxu commented 4 years ago

Thank you !

------------------ 原始邮件 ------------------ 发件人: "Jonathan Mackenzie"<notifications@github.com>; 发送时间: 2020年6月17日(星期三) 上午10:32 收件人: "maxpumperla/hyperas"<hyperas@noreply.github.com>; 抄送: "日常小迷糊"<1067887327@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [maxpumperla/hyperas] UnicodeDecodeError: 'gbk' codec can't decode byte 0xa2 in position 885: illegal multibyte sequence (#279)

This is likely because you have some chinese characters in your code. Consider removing them. A potential fix would involve changing this line:

https://github.com/maxpumperla/hyperas/blob/master/hyperas/optim.py#L188

to: with open(calling_script_file, 'r', encoding='utf-8') as f

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

JonnoFTW commented 4 years ago

@wenjuanxu if this solved your issue, please mark it as closed. Also mark your duplicate issues as solved as well.