Skip to content

Commit ffe8ca5

Browse files
authored
[Docs] Add Gif (galilai-group#140)
* update docs * add gif
1 parent ac5d4e8 commit ffe8ca5

23 files changed

Lines changed: 125 additions & 5 deletions

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,24 @@ results = world.evaluate(episodes=50)
4343
print(f"Success Rate: {results['success_rate']:.1f}%")
4444
```
4545

46+
## Supported Environments
47+
48+
| Environment | Normal | Variations |
49+
|:-----------:|:------:|:----------:|
50+
| **Cheetah** | <img src="docs/assets/cheetah.gif" width="200"> | <img src="docs/assets/cheetah_var.gif" width="200"> |
51+
| **Hopper** | <img src="docs/assets/hopper.gif" width="200"> | <img src="docs/assets/hopper_var.gif" width="200"> |
52+
| **Walker** | <img src="docs/assets/walker.gif" width="200"> | <img src="docs/assets/walker_var.gif" width="200"> |
53+
| **Quadruped** | <img src="docs/assets/quadruped.gif" width="200"> | <img src="docs/assets/quadruped_var.gif" width="200"> |
54+
| **Reacher** | <img src="docs/assets/reacher.gif" width="200"> | <img src="docs/assets/reacher_var.gif" width="200"> |
55+
| **Pendulum** | <img src="docs/assets/pendulum.gif" width="200"> | <img src="docs/assets/pendulum_var.gif" width="200"> |
56+
| **Cartpole** | <img src="docs/assets/cartpole.gif" width="200"> | <img src="docs/assets/cartpole_var.gif" width="200"> |
57+
| **Ball in Cup** | <img src="docs/assets/ballincup.gif" width="200"> | <img src="docs/assets/ballincup_var.gif" width="200"> |
58+
| **Finger** | <img src="docs/assets/finger.gif" width="200"> | <img src="docs/assets/finger_var.gif" width="200"> |
59+
| **Push-T** | <img src="docs/assets/pusht.gif" width="200"> | <img src="docs/assets/pusht_fov.gif" width="200"> |
60+
| **Two-Room** | <img src="docs/assets/tworoom.gif" width="200"> | <img src="docs/assets/tworoom_fov.gif" width="200"> |
61+
| **OGB Cube** | <img src="docs/assets/cube.gif" width="200"> | <img src="docs/assets/cube_fov.gif" width="200"> |
62+
| **OGB Scene** | <img src="docs/assets/scene.gif" width="200"> | <img src="docs/assets/scene_fov.gif" width="200"> |
63+
4664
## Contributing
4765

4866
Setup your codebase:

debug.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import os
2+
3+
os.environ['MUJOCO_GL'] = 'egl'
4+
5+
import stable_worldmodel as swm
6+
from stable_worldmodel.envs.dmcontrol import ExpertPolicy
7+
8+
9+
# record gif
10+
11+
12+
ENVS = {
13+
'swm/CartpoleDMControl-v0': ('cartpole',),
14+
'swm/WalkerDMControl-v0': ('walker',),
15+
'swm/QuadrupedDMControl-v0': ('quadruped',),
16+
'swm/BallInCupDMControl-v0': ('ballincup',),
17+
# 'swm/AcrobotDMControl-v0': ('acrobot',),
18+
'swm/FingerDMControl-v0': ('finger',),
19+
'swm/HopperDMControl-v0': ('hopper',),
20+
# 'swm/HumanoidDMControl-v0': ('humanoid',),
21+
# 'swm/ManipulatorDMControl-v0': ('manipulator',),
22+
'swm/CheetahDMControl-v0': ('cheetah',),
23+
'swm/ReacherDMControl-v0': ('reacher',),
24+
'swm/PendulumDMControl-v0': ('pendulum',),
25+
}
26+
27+
for env_name, (expert_name,) in ENVS.items():
28+
world = swm.World(
29+
env_name,
30+
num_envs=3,
31+
image_shape=(224, 224),
32+
max_episode_steps=500,
33+
)
34+
35+
option_names = [
36+
name
37+
for name in world.single_variation_space.names()
38+
if 'color' in name
39+
]
40+
41+
world.set_policy(
42+
ExpertPolicy(
43+
ckpt_path=f'../stable-expert/models/sac_dmcontrol/{expert_name}/expert_policy.zip',
44+
vec_normalize_path=f'../stable-expert/models/sac_dmcontrol/{expert_name}/vec_normalize.pkl',
45+
noise_std=0.3,
46+
device='cuda',
47+
)
48+
)
49+
50+
os.makedirs(f'./dmc/normal/{expert_name}_expert/', exist_ok=True)
51+
world.record_video(
52+
f'./dmc/normal/{expert_name}_expert/',
53+
max_steps=500,
54+
fps=24,
55+
extension='gif',
56+
)
57+
58+
os.makedirs(f'./dmc/var/{expert_name}_expert/', exist_ok=True)
59+
world.record_video(
60+
f'./dmc/var/{expert_name}_expert/',
61+
max_steps=500,
62+
fps=24,
63+
extension='gif',
64+
options={'variation': option_names},
65+
)

docs/assets/ballincup.gif

3.5 MB
Loading

docs/assets/ballincup_var.gif

2.58 MB
Loading

docs/assets/cartpole.gif

5.09 MB
Loading

docs/assets/cartpole_var.gif

1.6 MB
Loading

docs/assets/cheetah.gif

6.86 MB
Loading

docs/assets/cheetah_var.gif

6 MB
Loading

docs/assets/finger.gif

3.79 MB
Loading

docs/assets/finger_var.gif

2.79 MB
Loading

0 commit comments

Comments
 (0)