MiuLab / TC-Bot

User Simulation for Task-Completion Dialogues
MIT License
807 stars 295 forks source link

Fix to "ValueError: could not convert string to float:" #6

Open AtmaHou opened 7 years ago

AtmaHou commented 7 years ago

When I try to run the code with Rule Agent's prams, I got this: ValueError: could not convert string to float: My solution is changing the file-pointer loading style from "rb" to "r", and it works for me. Two place need to fix:

I know someone may not encounter the error, and just could enjoy the code perfectly.

Huyu2Jason commented 6 years ago

I encountered the same question as you did. I followed your guidance but I still face the question below. Traceback (most recent call last): File "run.py", line 213, in nlg_model.load_nlg_model(nlg_model_path) File "/home/jason/Jason/DialogueSystem/TC-Bot_U/src/deep_dialog/nlg/nlg.py", line 138, in load_nlg_model model_params = pickle.load(open(model_path, 'r')) ValueError: could not convert string to float

Could you please show me the way to solve this?

AtmaHou commented 6 years ago

Hi, My fix works only on windows, problem still remains for linux. Maybe, you are running on linux?

vpegasus commented 6 years ago

I encounter the problem too, and the solution doesn't work for me~ I don't understand why reading the model_path is related to 'convert string to float'?

wesleytao commented 6 years ago

I am facing the same problem

shibing624 commented 5 years ago

change to : model_params = pickle.load(open(model_path, 'rb'), encoding='iso-8859-1')

QiuSYang commented 4 years ago

encoding='iso-8859-1'

On what platform are you running this code。

hoomanvhd commented 4 years ago

I encountered the same question as you did. I followed your guidance but I still face the question below. Traceback (most recent call last): File "run.py", line 213, in nlg_model.load_nlg_model(nlg_model_path) File "/home/jason/Jason/DialogueSystem/TC-Bot_U/src/deep_dialog/nlg/nlg.py", line 138, in load_nlg_model model_params = pickle.load(open(model_path, 'r')) ValueError: could not convert string to float

Could you please show me the way to solve this?

The idea of loading pickle file is to load a binary coded file. since the models they have prepared are in string format you need to recreate the model files by loading the dictionaries out of the models by pickle.load and then dump it into another pickle file. or you can use different types of encoding on pickle.load

7huahua commented 1 year ago

dos2unix your_pickle_file.pk Replacing end-of-line from CR+LF (\r\n) into LF (\n) works for me