Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when run "python -m spinup.run test_policy output/" #303

Open
borninfreedom opened this issue Nov 5, 2020 · 0 comments
Open

Error when run "python -m spinup.run test_policy output/" #303

borninfreedom opened this issue Nov 5, 2020 · 0 comments

Comments

@borninfreedom
Copy link

borninfreedom commented Nov 5, 2020

An error occurred when I run "python -m spinup.run test_policy output/". The output is the trained policy. My train code is:

from spinup import ppo_pytorch as ppo
import torch
import torch.nn as nn
import gym
import cartpole_swingup_envs

env_fn=lambda:gym.make('CartPoleSwingUpContinuous-v0')
ac_kwargs=dict(hidden_sizes=[64,64],activation=nn.ReLU)
logger_kwargs=dict(output_dir='output',exp_name='cartpole_swingup')
ppo(env_fn=env_fn,ac_kwargs=ac_kwargs,steps_per_epoch=5000,
    epochs=300,logger_kwargs=logger_kwargs)

My config:

  • Ubuntu18.04
  • miniconda3, python3.7 virtual env

The Github link of cartpole_swingup_envs is cartpole_swingup_envs

The detailed error messages are:

Loading from output/pyt_save/model.pt.


Logging data to /tmp/experiments/1604566452/progress.txt
Traceback (most recent call last):
  File "/home/dell/drl-robots/cartpole-swingup/spinningup/spinup/utils/test_policy.py", line 153, in <module>
    run_policy(env, get_action, args.len, args.episodes, not(args.norender))
  File "/home/dell/drl-robots/cartpole-swingup/spinningup/spinup/utils/test_policy.py", line 124, in run_policy
    a = get_action(o)
  File "/home/dell/drl-robots/cartpole-swingup/spinningup/spinup/utils/test_policy.py", line 104, in get_action
    action = model.act(x)
  File "/home/dell/drl-robots/cartpole-swingup/spinningup/spinup/algos/pytorch/ppo/core.py", line 141, in act
    return self.step(obs)[0]
  File "/home/dell/drl-robots/cartpole-swingup/spinningup/spinup/algos/pytorch/ppo/core.py", line 134, in step
    pi = self.pi._distribution(obs)
  File "/home/dell/drl-robots/cartpole-swingup/spinningup/spinup/algos/pytorch/ppo/core.py", line 95, in _distribution
    mu = self.mu_net(obs)
  File "/home/dell/miniconda3/envs/py37env/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/dell/miniconda3/envs/py37env/lib/python3.7/site-packages/torch/nn/modules/container.py", line 92, in forward
    input = module(input)
  File "/home/dell/miniconda3/envs/py37env/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/dell/miniconda3/envs/py37env/lib/python3.7/site-packages/torch/nn/modules/linear.py", line 87, in forward
    return F.linear(input, self.weight, self.bias)
  File "/home/dell/miniconda3/envs/py37env/lib/python3.7/site-packages/torch/nn/functional.py", line 1372, in linear
    output = input.matmul(weight.t())
RuntimeError: Expected object of device type cuda but got device type cpu for argument #1 'self' in call to _th_mm
Exception ignored in: <function Viewer.__del__ at 0x7f3cdd8f19e0>
Traceback (most recent call last):
  File "/home/dell/miniconda3/envs/py37env/lib/python3.7/site-packages/gym/envs/classic_control/rendering.py", line 152, in __del__
  File "/home/dell/miniconda3/envs/py37env/lib/python3.7/site-packages/gym/envs/classic_control/rendering.py", line 71, in close
  File "/home/dell/miniconda3/envs/py37env/lib/python3.7/site-packages/pyglet/window/xlib/__init__.py", line 462, in close
  File "/home/dell/miniconda3/envs/py37env/lib/python3.7/site-packages/pyglet/gl/xlib.py", line 362, in destroy
  File "/home/dell/miniconda3/envs/py37env/lib/python3.7/site-packages/pyglet/gl/base.py", line 366, in destroy
  File "/home/dell/miniconda3/envs/py37env/lib/python3.7/site-packages/pyglet/gl/xlib.py", line 352, in detach
  File "/home/dell/miniconda3/envs/py37env/lib/python3.7/site-packages/pyglet/gl/lib.py", line 99, in errcheck
ImportError: sys.meta_path is None, Python is likely shutting down
Traceback (most recent call last):
  File "/home/dell/miniconda3/envs/py37env/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/dell/miniconda3/envs/py37env/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/dell/drl-robots/cartpole-swingup/spinningup/spinup/run.py", line 243, in <module>
    subprocess.check_call(args, env=os.environ)
  File "/home/dell/miniconda3/envs/py37env/lib/python3.7/subprocess.py", line 363, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/dell/miniconda3/envs/py37env/bin/python', '/home/dell/drl-robots/cartpole-swingup/spinningup/spinup/utils/test_policy.py', 'output/']' returned non-zero exit status 1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant