ledmands commited on
Commit
36f3504
1 Parent(s): 6aec4d8

record_video.py now functions, needs tuning

Browse files
agents/dqn_v2/record_video.py CHANGED
@@ -5,7 +5,7 @@ from stable_baselines3.common.vec_env import VecVideoRecorder, DummyVecEnv, VecE
5
 
6
  env_id = "ALE/Pacman-v5"
7
  video_folder = "videos/"
8
- video_length = 100 #steps
9
 
10
  vec_env = DummyVecEnv([lambda: gym.make(env_id, render_mode="rgb_array")])
11
  model = DQN.load("ALE-Pacman-v5")
@@ -16,8 +16,10 @@ model = DQN.load("ALE-Pacman-v5")
16
 
17
  # vec_env = Monitor(gym.make(env_id, render_mode="rgb_array"))
18
 
 
 
 
19
 
20
- # print(vec_env)
21
  obs = vec_env.reset()
22
 
23
 
@@ -26,10 +28,11 @@ vec_env = VecVideoRecorder(vec_env,
26
  video_folder,
27
  record_video_trigger=lambda x: x == 0,
28
  video_length=video_length,
29
- name_prefix=f"video-{env_id}")
 
30
  # Once I make the environment, now I need to walk through it...???
31
  # I want to act according to the policy that has been trained
32
- vec_env.reset()
33
  print(vec_env)
34
  for _ in range(video_length + 1):
35
  action, states = model.predict(obs)
 
5
 
6
  env_id = "ALE/Pacman-v5"
7
  video_folder = "videos/"
8
+ video_length = 1000 #steps
9
 
10
  vec_env = DummyVecEnv([lambda: gym.make(env_id, render_mode="rgb_array")])
11
  model = DQN.load("ALE-Pacman-v5")
 
16
 
17
  # vec_env = Monitor(gym.make(env_id, render_mode="rgb_array"))
18
 
19
+ print("\n\n\n")
20
+ print(vec_env)
21
+ print("\n\n\n")
22
 
 
23
  obs = vec_env.reset()
24
 
25
 
 
28
  video_folder,
29
  record_video_trigger=lambda x: x == 0,
30
  video_length=video_length,
31
+ # name_prefix=f"video-{env_id}"
32
+ )
33
  # Once I make the environment, now I need to walk through it...???
34
  # I want to act according to the policy that has been trained
35
+ obs = vec_env.reset()
36
  print(vec_env)
37
  for _ in range(video_length + 1):
38
  action, states = model.predict(obs)
agents/dqn_v2/videos/rl-video-step-0-to-step-1000.meta.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"step_id": 0, "content_type": "video/mp4"}
agents/dqn_v2/videos/rl-video-step-0-to-step-1000.mp4 ADDED
Binary file (140 kB). View file