From 3ab82ad36bce6fa698a13a029a0694b75a5947b7 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Fri, 6 Aug 2021 02:42:45 +0200 Subject: Fix VQVAE into en/decoder, bug in wandb artifact code uploading --- training/callbacks/wandb_callbacks.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'training/callbacks') diff --git a/training/callbacks/wandb_callbacks.py b/training/callbacks/wandb_callbacks.py index 61d71df..2264750 100644 --- a/training/callbacks/wandb_callbacks.py +++ b/training/callbacks/wandb_callbacks.py @@ -39,8 +39,8 @@ class WatchModel(Callback): class UploadCodeAsArtifact(Callback): """Upload all *.py files to W&B as an artifact, at the beginning of the run.""" - def __init__(self, project_dir: str) -> None: - self.project_dir = Path(project_dir) + def __init__(self) -> None: + self.project_dir = Path(__file__).resolve().parents[2] / "text_recognizer" @rank_zero_only def on_train_start(self, trainer: Trainer, pl_module: LightningModule) -> None: @@ -49,7 +49,7 @@ class UploadCodeAsArtifact(Callback): experiment = logger.experiment artifact = wandb.Artifact("project-source", type="code") for filepath in self.project_dir.glob("**/*.py"): - artifact.add_file(filepath) + artifact.add_file(str(filepath)) experiment.use_artifact(artifact) @@ -60,7 +60,7 @@ class UploadCheckpointsAsArtifact(Callback): def __init__( self, ckpt_dir: str = "checkpoints/", upload_best_only: bool = False ) -> None: - self.ckpt_dir = ckpt_dir + self.ckpt_dir = Path(__file__).resolve().parent / ckpt_dir self.upload_best_only = upload_best_only @rank_zero_only -- cgit v1.2.3-70-g09d2