ledmands commited on
Commit
5d0eb73
1 Parent(s): ca16748

Updated watch agent script to remove rendering option

Browse files
Files changed (1) hide show
  1. watch_agent.py +4 -15
watch_agent.py CHANGED
@@ -30,14 +30,8 @@ parser.add_argument("-e", "--num_episodes", help="specify the number of episodes
30
  parser.add_argument("-a", "--agent_filepath", help="file path to agent to watch, minus the .zip extension", type=str, required=True)
31
  args = parser.parse_args()
32
 
33
- MODEL_NAME = args.agent_filepath
34
- loaded_model = DQN.load(MODEL_NAME)
35
-
36
- # Toggle the render mode based on the -o flag
37
- # if args.observe == True:
38
- # mode = "human"
39
- # else:
40
- # mode = "rgb_array"
41
 
42
  # Retrieve the environment
43
  eval_env = Monitor(gym.make("ALE/Pacman-v5",
@@ -49,10 +43,5 @@ if args.print == True:
49
  env_info = str(eval_env.spec).split(", ")
50
  for item in env_info:
51
  print(item)
52
- # Evaluate the policy
53
- # mean_rwd, std_rwd =
54
-
55
- evaluate_policy(loaded_model.policy, eval_env, n_eval_episodes=args.num_episodes)
56
- # print("eval episodes: ", args.num_episodes)
57
- # print("mean rwd: ", mean_rwd)
58
- # print("std rwd: ", std_rwd)
 
30
  parser.add_argument("-a", "--agent_filepath", help="file path to agent to watch, minus the .zip extension", type=str, required=True)
31
  args = parser.parse_args()
32
 
33
+ model_name = args.agent_filepath
34
+ model = DQN.load(model_name)
 
 
 
 
 
 
35
 
36
  # Retrieve the environment
37
  eval_env = Monitor(gym.make("ALE/Pacman-v5",
 
43
  env_info = str(eval_env.spec).split(", ")
44
  for item in env_info:
45
  print(item)
46
+ # Evaluate the policy to render the agent
47
+ evaluate_policy(model.policy, eval_env, n_eval_episodes=args.num_episodes)