Giter VIP home page Giter VIP logo

Comments (1)

swenner avatar swenner commented on July 29, 2024

Fix for the first issue.

--- a/samples/a2c.py
+++ b/samples/a2c.py
@@ -93,10 +96,12 @@ if __name__ == "__main__":
 
     # model returns probability of actions
     model = Model(env.action_space.n, env.observation_space.shape[0])
+    device="cpu"
     if cuda_enabled:
         model.cuda()
+        device = "cuda"
 
-    agent = ptan.agent.PolicyAgent(a3c_actor_wrapper(model), cuda=cuda_enabled)
+    agent = ptan.agent.PolicyAgent(a3c_actor_wrapper(model), device=device)
     exp_source = ptan.experience.ExperienceSource(env=env, agent=agent, steps_count=run.getint("learning", "n_steps"))
 
     optimizer = optim.RMSprop(model.parameters(), lr=run.getfloat("learning", "lr"))

But then I hit the next one:

python3 a2c.py -r runs/a2c/a2c_cartpole.ini 
Traceback (most recent call last):
  File "a2c.py", line 172, in 
    for exp in exp_source:
  File "/home/simon/ptan-git/ptan/experience.py", line 82, in __iter__
    states_actions, new_agent_states = self.agent(states_input, agent_states)
  File "/home/simon/ptan-git/ptan/agent.py", line 129, in __call__
    probs_v = self.model(states)
  File "a2c.py", line 64, in _wrap
    x = model(x)
  File "/home/simon/.local/lib/python3.5/site-packages/torch/nn/modules/module.py", line 477, in __call__
    result = self.forward(*input, **kwargs)
  File "a2c.py", line 53, in forward
    x = self.fc1(x)
  File "/home/simon/.local/lib/python3.5/site-packages/torch/nn/modules/module.py", line 477, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/simon/.local/lib/python3.5/site-packages/torch/nn/modules/linear.py", line 55, in forward
    return F.linear(input, self.weight, self.bias)
  File "/home/simon/.local/lib/python3.5/site-packages/torch/nn/functional.py", line 1024, in linear
    return torch.addmm(bias, input, weight.t())
RuntimeError: Expected object of type torch.FloatTensor but found type torch.DoubleTensor for argument #4 'mat1'

from ptan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.