kengz/SLM-Lab

Fail to save graphs

alessandroweiliu opened this issue · 5 comments

I follow the book "Foundations of Deep Reinforcement Learning" to conduct the experiments of reinformace algorithm.Although the algorithm can be conducted successfully, its graphs fail to be saved successfully, with an error from orca "service unavaialble".

  1. OS and environment: Ubuntu 16.04
  2. spec file used: reinforce_cartpole.json

Additional context
Add any other context about the problem here.

Error logs
Failed to generate graph. Run retro-analysis to generate graphs later.
The image request was rejected by the orca conversion utility
with the following error:
503:

<title>503 Service Unavailable</title>

Service Unavailable

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

kengz commented

seems like the orca server is not started properly. Could you kill the orca processes and try the Orca quickstart command inside the Conda environment.

Run:

conda activate lab
orca graph '{ "data": [{"y": [1,2,1]}] }' -o fig.png

and see if it completes successfully or returns the same error?

kengz commented

#453 includes a new plotly and orca server that should should this issue; please fetch the repo update and update the conda environment. Closing now for inactivity.

Similar problem in macOS 12.0.1.

Running

python run_lab.py slm_lab/spec/benchmark/sarsa/sarsa_cartpole.json sarsa_epsilon_greedy_cartpole train

(and other training scripts, e.g., REINFORCE) generates a warning message

[2021-12-11 14:33:04,621 PID:22667 WARNING viz.py <lambda>] Failed to generate graph. Run retro-analysis to generate graphs later.
The image request was rejected by the orca conversion utility
with the following error:
   502:

If running on a headless server, prepend your Python command with `xvfb-run -a `, for example `xvfb-run -a python run_lab.py`

The data/***/graph directory is empty.

I have tied the command

orca graph '{ "data": [{"y": [1,2,1]}] }' -o fig.png

It works fine and generates the expected png image file.

I checked that the version of dependences coincides with #453, i.e., plotly==4.5.4. But the issue still exists.

kengz commented

Seems like Plotly has shifted away from orca for static image generation since version 4.9.0
Could you please try the following command then rerun to see if it resolves your issue? If so I'll commit an update in the plotly dependencies.

conda activate lab
conda remove --force plotly-orca
conda remove --force plotly
conda install plotly=4.9.0
pip install kaleido

This solves my issue. Thanks.