stanfordnmbl / osim-rl

Reinforcement learning environments with musculoskeletal models
http://osim-rl.stanford.edu/
MIT License
877 stars 248 forks source link

Error when running ddpg.keras-rl.py --visualize --train --model sample #219

Open maxenceliu opened 4 years ago

maxenceliu commented 4 years ago

I followed the doc, Training your fist model, then I got the following errors. what could i do to solve this problem?

Traceback (most recent call last): File "ddpg.keras-rl.py", line 87, in agent.fit(env, nb_steps=nallsteps, visualize=False, verbose=1, nb_max_episode_steps=env.time_limit, log_interval=10000) File "/home/max/anaconda3/envs/opensim-rl/lib/python3.6/site-packages/rl/core.py", line 178, in fit action = self.forward(observation) File "/home/max/anaconda3/envs/opensim-rl/lib/python3.6/site-packages/rl/agents/ddpg.py", line 212, in forward action = self.select_action(state) # TODO: move this into policy File "/home/max/anaconda3/envs/opensim-rl/lib/python3.6/site-packages/rl/agents/ddpg.py", line 198, in select_action action = self.actor.predict_on_batch(batch).flatten() File "/home/max/anaconda3/envs/opensim-rl/lib/python3.6/site-packages/keras/engine/training.py", line 1574, in predict_onbatch x, , _ = self._standardize_user_data(x) File "/home/max/anaconda3/envs/opensim-rl/lib/python3.6/site-packages/keras/engine/training.py", line 579, in _standardize_user_data exception_prefix='input') File "/home/max/anaconda3/envs/opensim-rl/lib/python3.6/site-packages/keras/engine/training_utils.py", line 135, in standardize_input_data 'with shape ' + str(data_shape)) ValueError: Error when checking input: expected flatten_1_input to have 3 dimensions, but got array with shape (1, 1)

AffDk commented 3 years ago

Hi,

I face a very similar issue. did you find a solution for this?

Best, Afshin

kidzik commented 3 years ago

The code is relatively old and keras-rl is not maintained anymore, but I managed to run it with some very specific versions of packages for a tutorial in a summer school https://colab.research.google.com/drive/1Kbubb9_L-MDtjt0nHVYR_zF9CK1Onz4C

AffDk commented 3 years ago

Hi,

Thanks for the hint. I followed the instructions but after running

jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' --port=8888 --NotebookApp.port_retries=0 --no-browser

I faced the following error (see below). I also tried to run the alternative approach to run everything on google colab but this one did not go through either. it does not find the osim even though I tried to add it to the system path. The added path, I think, is set for a linux machine, right? I run it one a windows. I tried to find a corresponding path on my computer but did not really find it exactly. I was searching in C:\Users\XX\AppData\Local\Continuum\anaconda3\Pkgs\python-3.6.1-3

but it did not seem to resolve anything.

Best regards, Afshin

jupyter_http_over_ws extension initialized. Listening on /http_over_websocket [W 09:59:51.242 NotebookApp] Error loading server extension jupyterlab_git Traceback (most recent call last): File "c:\users\afsamani\appdata\local\continuum\anaconda3\envs\opensim-rl\lib\site-packages\notebook\notebookapp.py", line 2027, in init_server_extensions mod = importlib.import_module(modulename) File "c:\users\afsamani\appdata\local\continuum\anaconda3\envs\opensim-rl\lib\importlib__init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 953, in _find_and_load_unlocked ModuleNotFoundError: No module named 'jupyterlab_git' [W 09:59:51.246 NotebookApp] Error loading server extension nbdime Traceback (most recent call last): File "c:\users\afsamani\appdata\local\continuum\anaconda3\envs\opensim-rl\lib\site-packages\notebook\notebookapp.py", line 2027, in init_server_extensions mod = importlib.import_module(modulename) File "c:\users\afsamani\appdata\local\continuum\anaconda3\envs\opensim-rl\lib\importlib\init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 953, in _find_and_load_unlocked ModuleNotFoundError: No module named 'nbdime' [I 09:59:51.250 NotebookApp] Serving notebooks from local directory: C:\Users\afsamani [I 09:59:51.251 NotebookApp] Jupyter Notebook 6.4.0 is running at: [I 09:59:51.251 NotebookApp] http://localhost:8888/?token=1b5617c2b33101124dbe7b11345e2f044361144b3835f044 [I 09:59:51.252 NotebookApp] or http://127.0.0.1:8888/?token=1b5617c2b33101124dbe7b11345e2f044361144b3835f044 [I 09:59:51.252 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [C 09:59:51.264 NotebookApp]

To access the notebook, open this file in a browser:
    file:///C:/Users/afsamani/AppData/Roaming/jupyter/runtime/nbserver-18428-open.html
Or copy and paste one of these URLs:
    http://localhost:8888/?token=1b5617c2b33101124dbe7b11345e2f044361144b3835f044
 or http://127.0.0.1:8888/?token=1b5617c2b33101124dbe7b11345e2f044361144b3835f044

[W 09:59:54.123 NotebookApp] 404 GET /api/kernels/e07f1c76-57b3-4616-be3c-533bd2d7d4a9/channels?session_id=0ebdb99bc2d246a280cfb1cec26d6d43 (::1): Kernel does not exist: e07f1c76-57b3-4616-be3c-533bd2d7d4a9 [W 09:59:54.187 NotebookApp] 404 GET /api/kernels/e07f1c76-57b3-4616-be3c-533bd2d7d4a9/channels?session_id=0ebdb99bc2d246a280cfb1cec26d6d43 (::1) 68.820000ms referer=None

AffDk commented 3 years ago

Hi,

I have tried to implement something in matlab similar to what you did in Python. I have made an issue for it in the opensim forum:

https://simtk.org/plugins/phpBB/viewtopicPhpbb.php?f=91&t=13481&p=38676&start=0&view=&sid=e443ffcfdeb3393082b2bec904c415f3

it initially runs but matlab gets crashed after a few minutes. It does not return any error message so I have no idea what the problem could be. I appreciate if you could also try it on your system and let me know if you have any idea about what could be wrong.

Best, Afshin