diff --git a/src/pytti/ImageGuide.py b/src/pytti/ImageGuide.py index 7bd10d1..5aff2b9 100644 --- a/src/pytti/ImageGuide.py +++ b/src/pytti/ImageGuide.py @@ -366,8 +366,11 @@ def report_out( if model.dataframe: rec = model.dataframe[0].iloc[-1] logger.debug(rec) - for k, v in rec.iteritems(): - writer.add_scalar(tag=f"losses/{k}", scalar_value=v, global_step=i) + if writer is not None: + for k, v in rec.iteritems(): + writer.add_scalar( + tag=f"losses/{k}", scalar_value=v, global_step=i + ) # does this VRAM stuff even do anything? if approximate_vram_usage: @@ -420,13 +423,14 @@ def save_out( im.save(filename) im_np = np.array(im) - writer.add_image( - tag="pytti output", - # img_tensor=filename, # thought this would work? - img_tensor=im_np, - global_step=i, - dataformats="HWC", # this was the key - ) + if writer is not None: + writer.add_image( + tag="pytti output", + # img_tensor=filename, # thought this would work? + img_tensor=im_np, + global_step=i, + dataformats="HWC", # this was the key + ) if backups > 0: filename = f"backup/{file_namespace}/{base_name}_{n}.bak" diff --git a/tests/config/default.yaml b/tests/config/default.yaml index fcfdbf6..79f9e4d 100644 --- a/tests/config/default.yaml +++ b/tests/config/default.yaml @@ -134,6 +134,7 @@ save_every: 50 backups: 5 show_graphs: false approximate_vram_usage: false +use_tensorboard: false ##################################### diff --git a/tests/test_animation_broken.py b/tests/test_animation_broken.py index 349227e..0bfbbec 100644 --- a/tests/test_animation_broken.py +++ b/tests/test_animation_broken.py @@ -87,6 +87,9 @@ "gradient_accumulation_steps": 1, "border_mode": "clamp", "models_parent_dir": ".", + ########################## + # adding new config items for backwards compatibility + "use_tensorboard": True, # This should actually default to False. Prior to April2022, tb was non-optional }