in grok/training.py [0:0]
def _save_inputs(self, outputs: Dict, ds: str) -> None:
"""
Saves the input equations to disk for analysis later
:param outputs: a list of tuples from self.training_step()
:param ds: a string ('train' or 'val') naming which dataset
these inputs are from.
:param train: True is this is a training batch, false otherwise
"""
logdir = self.hparams.logdir + "/inputs/" + ds # type: ignore
os.makedirs(logdir, exist_ok=True)
pickle_file = logdir + f"/{ds}.pt"
x_lhs = torch.cat([x["x_lhs"] for x in outputs])
with open(pickle_file, "wb") as fh:
torch.save(x_lhs, fh)