torrvision / crayon

A language-agnostic interface to TensorBoard
MIT License
779 stars 59 forks source link

json.decoder.JSONDecodeError #20

Closed AjayTalati closed 7 years ago

AjayTalati commented 7 years ago

Hi, thanks for making this project open source.

I get the following error,

Traceback (most recent call last): File "/home/ajay/anaconda3/envs/pyphi/lib/python3.6/multiprocessing/process.py", line 249, in _bootstrap self.run() File "/home/ajay/anaconda3/envs/pyphi/lib/python3.6/multiprocessing/process.py", line 93, in run self._target(*self._args, **self._kwargs) File "/home/ajay/PythonProjects/PyT_Neural_Arch_Search_v1_2/train_v1.py", line 201, in train foo.get_scalar_values("Mean Reward") File "/home/ajay/anaconda3/envs/pyphi/lib/python3.6/site-packages/pycrayon/crayon.py", line 167, in get_scalar_values return json.loads(r.text) File "/home/ajay/anaconda3/envs/pyphi/lib/python3.6/json/__init__.py", line 354, in loads return _default_decoder.decode(s) File "/home/ajay/anaconda3/envs/pyphi/lib/python3.6/json/decoder.py", line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/home/ajay/anaconda3/envs/pyphi/lib/python3.6/json/decoder.py", line 357, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

When I run the following in a single thread

cc = CrayonClient( hostname="http://127.0.1.1" , port=8889)
foo = cc.create_experiment("train_" + str(rank))

foo.add_scalar_value("Mean Reward", mean_reward, step = episode_count)
foo.add_scalar_value("Max Reward" , max_reward,  step = episode_count)

foo.get_scalar_values("Mean Reward")
foo.get_scalar_values("Max Reward")

Seems to work fine when I run it from the python interpreter though?

albanD commented 7 years ago

Hi, Could you share a minimal failing script please? I would be happy to look into the issue and fix it.

AjayTalati commented 7 years ago

Hi, @albanD, I think it's working now :+1: , what I changed was,

i) removing the foo.get_scalar_values() lines, and ii) giving each thread a distinct name with,

exp_name = "train_" + str(rank) + "_" + datetime.now().strftime('train_%m-%d_%H-%M') 
foo = cc.create_experiment(exp_name)

crayon_multithread_working

All the best, Aj