add option to disable planning with mpc=false
This commit is contained in:
@@ -85,7 +85,10 @@ class TDMPC2:
|
|||||||
if task is not None:
|
if task is not None:
|
||||||
task = torch.tensor([task], device=self.device)
|
task = torch.tensor([task], device=self.device)
|
||||||
z = self.model.encode(obs, task)
|
z = self.model.encode(obs, task)
|
||||||
|
if self.cfg.mpc:
|
||||||
a = self.plan(z, t0=t0, eval_mode=eval_mode, task=task)
|
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()
|
return a.cpu()
|
||||||
|
|
||||||
@torch.no_grad()
|
@torch.no_grad()
|
||||||
|
|||||||
Reference in New Issue
Block a user