def save_image_vectors(model, dataloader_test): utils.rm_dir(Dir.image_vectors) with torch.no_grad(): model.eval() for img, _, img_name, _ in dataloader_test: vectors = model(img.to("cuda")) for i, v in enumerate(vectors): path = Dir.image_vectors / Path(img_name[i]).relative_to(Dir.images) path.parent.mkdir(exist_ok=True, parents=True) torch.save(v, str(path))
def _create_terraform_root(self): utils.rm_dir(self.terraform_root) utils.mkdir_p(self.terraform_root)
def checkpoint_flush(self, silent=True): rm_dir(self.ckpt_dir, silent)
def summary_flush(self, silent=True): rm_dir(self.summary_dir, silent)