Git Product home page Git Product logo

Comments (7)

Trinkle23897 avatar Trinkle23897 commented on July 16, 2024

You can use gym.wrapper.
Btw, the limitation of Pendulum-v0 defaults to be 200 frames. So what's your gym version? (0.17.1 for me and works fine, at 200th timestep it returns done=True)

from tianshou.

Trinkle23897 avatar Trinkle23897 commented on July 16, 2024

The reference code:

In [14]: import gym 
    ...: print(gym.__version__) 
    ...: e = gym.make('Pendulum-v0') 
    ...: e.reset() 
    ...: i, d = 0, False 
    ...: while not d: 
    ...:     _, _, d, _ = e.step([0.1]) 
    ...:     i += 1 
    ...: print(i)
0.17.1
200

from tianshou.

M1ddlzh avatar M1ddlzh commented on July 16, 2024

I see "done=False“ in sourcecode pendulum.py, you mean "gym.Wrapper" does extra work ( 200th timestep) on Pendulum?

from tianshou.

Trinkle23897 avatar Trinkle23897 commented on July 16, 2024

No, I mean the default gym.make('Pendulum-v0') will not cause this problem. Manually adding gym.wrapper is the last choice.

from tianshou.

M1ddlzh avatar M1ddlzh commented on July 16, 2024

I think setting "done=True" after 200 steps is added by "gym.Wrapper".

In your code above, I add "e.unwrapped" after "e = gym.make('Pendulum-v0')", it will not break the while loop.

from tianshou.

M1ddlzh avatar M1ddlzh commented on July 16, 2024

In my one Env, using tianshou.ppo to train the agent always warning "'There are already many steps in an episode. You should add a time limitation to your environment!", but Pendulum doesn't warning. At first I think you did something magic in tianshou's code so I open a issue. Sorry for taking your time, Thanks!

from tianshou.

Trinkle23897 avatar Trinkle23897 commented on July 16, 2024

Yes, unwrapped action will remove the time limit added by the gym.wrapper.

from tianshou.

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.