Skip to content

Commit

Permalink
add option to disable planning with mpc=false
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklashansen committed Jan 5, 2024
1 parent 13cac07 commit a7ff00b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tdmpc2/tdmpc2.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ def act(self, obs, t0=False, eval_mode=False, task=None):
if task is not None:
task = torch.tensor([task], device=self.device)
z = self.model.encode(obs, task)
a = self.plan(z, t0=t0, eval_mode=eval_mode, task=task)
if self.cfg.mpc:
a = self.plan(z, t0=t0, eval_mode=eval_mode, task=task)
else:
a = self.model.pi(z, task)[int(not eval_mode)][0]
return a.cpu()

@torch.no_grad()
Expand Down

0 comments on commit a7ff00b

Please sign in to comment.