ledmands
commited on
Commit
•
2690fb6
1
Parent(s):
94c3490
Changed the video recorder directory
Browse files
CustomVideoRecorder/CustomVideoRecorder.py
ADDED
File without changes
|
CustomVideoRecorder/__init.py__
ADDED
File without changes
|
agents/record_video.py → record_video.py
RENAMED
@@ -3,10 +3,10 @@ from stable_baselines3 import DQN
|
|
3 |
from stable_baselines3.common.monitor import Monitor
|
4 |
from stable_baselines3.common.vec_env import VecVideoRecorder, DummyVecEnv, VecEnv
|
5 |
|
6 |
-
model_name = "dqn_v2-
|
7 |
env_id = "ALE/Pacman-v5"
|
8 |
video_folder = "videos/"
|
9 |
-
video_length = 100000 #steps
|
10 |
|
11 |
vec_env = DummyVecEnv([lambda: gym.make(env_id, render_mode="rgb_array")])
|
12 |
model = DQN.load(model_name)
|
@@ -29,7 +29,7 @@ vec_env = VecVideoRecorder(vec_env,
|
|
29 |
video_folder,
|
30 |
record_video_trigger=lambda x: x == 0,
|
31 |
video_length=video_length,
|
32 |
-
|
33 |
)
|
34 |
# Once I make the environment, now I need to walk through it...???
|
35 |
# I want to act according to the policy that has been trained
|
|
|
3 |
from stable_baselines3.common.monitor import Monitor
|
4 |
from stable_baselines3.common.vec_env import VecVideoRecorder, DummyVecEnv, VecEnv
|
5 |
|
6 |
+
model_name = "agents/dqn_v2-7/ALE-Pacman-v5" # path to model, should be an argument
|
7 |
env_id = "ALE/Pacman-v5"
|
8 |
video_folder = "videos/"
|
9 |
+
video_length = 100000 #steps by hard coding this, I can almost ensure only one episode is recorded...
|
10 |
|
11 |
vec_env = DummyVecEnv([lambda: gym.make(env_id, render_mode="rgb_array")])
|
12 |
model = DQN.load(model_name)
|
|
|
29 |
video_folder,
|
30 |
record_video_trigger=lambda x: x == 0,
|
31 |
video_length=video_length,
|
32 |
+
name_prefix=f"video-{model_name}"
|
33 |
)
|
34 |
# Once I make the environment, now I need to walk through it...???
|
35 |
# I want to act according to the policy that has been trained
|