Skip to content

Commit

Permalink
Add non-deterministic evalation
Browse files Browse the repository at this point in the history
  • Loading branch information
ikostrikov2 committed Sep 23, 2018
1 parent ee40508 commit 3e95f62
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion enjoy.py
Expand Up @@ -19,8 +19,12 @@
help='directory to save agent logs (default: ./trained_models/)')
parser.add_argument('--add-timestep', action='store_true', default=False,
help='add timestep to observations')
parser.add_argument('--non-det', action='store_true', default=False,
help='whether to use a non-deterministic policy')
args = parser.parse_args()

args.det = not args.non_det

env = make_vec_envs(args.env_name, args.seed + 1000, 1,
None, None, args.add_timestep, device='cpu',
allow_early_resets=False)
Expand Down Expand Up @@ -56,7 +60,7 @@
while True:
with torch.no_grad():
value, action, _, recurrent_hidden_states = actor_critic.act(
obs, recurrent_hidden_states, masks, deterministic=True)
obs, recurrent_hidden_states, masks, deterministic=args.det)

# Obser reward and next obs
obs, reward, done, _ = env.step(action)
Expand Down

0 comments on commit 3e95f62

Please sign in to comment.