Skip to content

Commit

Permalink
wrapped dangling writers, fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarx committed Apr 1, 2022
1 parent ad4b4db commit 9442fbe
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/pytti/ImageGuide.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions tests/config/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ save_every: 50
backups: 5
show_graphs: false
approximate_vram_usage: false
use_tensorboard: false

#####################################

Expand Down
3 changes: 3 additions & 0 deletions tests/test_animation_broken.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
}


Expand Down

0 comments on commit 9442fbe

Please sign in to comment.