File size: 1,546 Bytes
246c106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import numpy as np
from sim.main import InteractiveDigitalWorld
from sim.simulator import GenieSimulator, RobomimicSimulator
from sim.policy import RandomJointPositionPolicy

if __name__ == '__main__':
    robomimic_simulator = RobomimicSimulator(env_name='lift')
    genie_simulator = GenieSimulator(
        image_encoder_type="magvit",
        image_encoder_ckpt="data/magvit2.ckpt",
        quantize=True,
        backbone_type="stmaskgit",
        backbone_ckpt="data/genie_lang/maskgit256",
        prompt_horizon=8,

        # image_encoder_type='temporalvae',
        # image_encoder_ckpt='stabilityai/stable-video-diffusion-img2vid',
        # quantize=False,
        # backbone_type="stmar",
        # backbone_ckpt="data/genie_lang/mar1024",
        # prompt_horizon=11,
        
        action_stride=1,
        domain='robomimic',
        physics_simulator=robomimic_simulator,
        compute_psnr=False,
        compute_delta_psnr=False,
    )
    # use whatever current state is as the initial state
    genie_simulator.reset()
    random_policy = RandomJointPositionPolicy(
        action_bounds=(
            np.array([-0.5] * 7),
            np.array([0.5] * 7)
        )
    )
    playground = InteractiveDigitalWorld(
        simulator=genie_simulator,
        policy=random_policy,
        offscreen=True,
        window_size=(512 * 2, 512)  # [genie image | GT image] side-by-side
    )

    for _ in range(50):
        playground.step()

    playground.save_video(save_path='test.mp4', as_gif=False)
    playground.close()