lorenmt / minimal-isaac-gym Goto Github PK
View Code? Open in Web Editor NEWA Minimal Example of Isaac Gym with DQN and PPO.
A Minimal Example of Isaac Gym with DQN and PPO.
Hi Shikun & Marwan, thank you for releasing this repo!
I'm using DQN implementation in my customed environment. However, I have noticed that resetting the environment in every step of the run() function (located in this line of code) is causing an issue. It seems that this can cause the agent to become stuck in the initial scene of the environment.
In addition, the evaluation consequently doesn't make sense due to reset and we have 1-step evaluation.
I'm running the code (both CartPole & mine) headlessly, so I'm not very sure about the conclusion of CartPole above, but indeed the bug happens in custom environment.
I have a working install of IsaagGym, IsaacGymEnvs and rl-games, and I just followed the steps in this repository's README to get it to run, however I get the following issue :
Traceback (most recent call last):
File "trainer.py", line 35, in <module>
policy.run()
File "/home/theo/Documents/minimal-isaac-gym/dqn.py", line 105, in run
self.env.step(action)
File "/home/theo/Documents/minimal-isaac-gym/env.py", line 199, in step
self.get_reward()
File "/home/theo/Documents/minimal-isaac-gym/env.py", line 139, in get_reward
self.max_episode_length)
RuntimeError: MALFORMED INPUT: Cannot broadcast to a lower rank tensor
Does anyone know whether this is a common issue ?
Hi Shikun & Marwan, thank you for releasing this repo!
My conclusion: I think the code on line 103 in ppo.py will get the wrong result. My solution is to remove the reversed
function.
I simplified a trajectory into s1, s2, ... , st.
self.env.step(action)
next_obs, reward, done = self.env.obs_buf.clone(), self.env.reward_buf.clone(), self.env.reset_buf.clone()
self.env.reset()
self.data.append((obs, action, reward, next_obs, log_prob, 1 - done))
Therefore, in self.data, it is like s1, s2, ... ,st.
After self.data.pop(), the obs, action and reward are located at the last position of trajectory.
So obs_lst
is like st, st-1, ..., sk (k=t-self.mini_chunk_size+1).
After executing the code on line 92, obs
is like st, st-1, ..., sk (k=t-self.mini_chunk_size+1).
The variable delta
is also like st, st-1, ..., sk. (delta_t, ... delta_k)
One calculation method of GAE is from back to front (the same as in the code):
But the code on line 102 reverses the delta
, reversed(delta)
is like sk, sk+1, ... st.
So I think the code on line 103 will get the wrong result. My solution is to remove the reversed
function.
But I found that removing the reversed function has little effect on the training results [Lol]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.