# Overriding logged media

**URL:** <https://community.wandb.ai/t/overriding-logged-media/1855>\
**Category:** W&B Help\
**Tags:** wandb\
**Created:** [February 1, 2022, 3:36pm UTC](https://community.wandb.ai/t/overriding-logged-media/1855 "2022-02-01T15:36:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![artuntun](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@artuntun](https://community.wandb.ai/u/artuntun)\
**Post date:** [February 1, 2022, 3:36pm UTC](https://community.wandb.ai/t/overriding-logged-media/1855/1 "2022-02-01T15:36:21Z")

</div>

Hey there ✋

During my training I want to produce some visual outputs every epoch to monitor that the predictions make sense. I am logging a matplotlib figure with:

```python
 logger.log({'last epoch': fig})

```

The issue is that wandb is saving every figure that is produced instead of overwriting the last one. How can this be achieved?

Thanks in advance  
Arturo

---

<div class="post-metadata">

**Author:** ![aidanjd](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/aidanjd/32/258_2.png) [@aidanjd](https://community.wandb.ai/u/aidanjd)\
**Post date:** [February 1, 2022, 5:16pm UTC](https://community.wandb.ai/t/overriding-logged-media/1855/2 "2022-02-01T17:16:15Z")

</div>

Hi, @artuntun , right now you are logging the figure to the key called “last epoch”. If you just log it normally like `wandb.log({'epoch': epoch, 'predictions_fig': fig})` then you will be able to see the most recent figure but also have the option to toggle back through all the other figures at each epoch to see how your predictions evolved overtime.

---

<div class="post-metadata">

**Author:** ![artuntun](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@artuntun](https://community.wandb.ai/u/artuntun)\
**Post date:** [February 2, 2022, 9:44am UTC](https://community.wandb.ai/t/overriding-logged-media/1855/3 "2022-02-02T09:44:04Z")

</div>

that is the behavior that is already happening. What I actually want is to not save all of them. It a heavy figure and I don’t want to save that much data.

---

<div class="post-metadata">

**Author:** ![aidanjd](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/aidanjd/32/258_2.png) [@aidanjd](https://community.wandb.ai/u/aidanjd)\
**Post date:** [February 4, 2022, 11:34am UTC](https://community.wandb.ai/t/overriding-logged-media/1855/4 "2022-02-04T11:34:55Z")

</div>

Ahh I see. In that case, I would recommend only logging your final image. By design, it is difficult to delete or overwrite data logged to a run, during a run. This is to prevent accidental data loss and preserve as much of the experiment as possible. Alternatively, if you just wanted to log the image file, you could save it with wandb.save(path-to-image).

---

<div class="post-metadata">

**Author:** ![artuntun](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@artuntun](https://community.wandb.ai/u/artuntun)\
**Post date:** [February 7, 2022, 8:40am UTC](https://community.wandb.ai/t/overriding-logged-media/1855/5 "2022-02-07T08:40:16Z")

</div>

thanks for the response aidanjd  
Is it possible to log the final image if I stop the training loop manually?

---

<div class="post-metadata">

**Author:** ![aidanjd](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/aidanjd/32/258_2.png) [@aidanjd](https://community.wandb.ai/u/aidanjd)\
**Post date:** [February 10, 2022, 5:29pm UTC](https://community.wandb.ai/t/overriding-logged-media/1855/6 "2022-02-10T17:29:04Z")

</div>

Hi @artuntun , saving the image with `wandb.save()` will achieve this naturally though your image won’t appear in the workspace panels. The other way of doing this would be to catch whatever interrupt errors you are throwing to stop you training loop and call your end of training image logging then.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/wandb/original/1X/366b649231631dbab896843020da0056074ac79d.png) [@system](https://community.wandb.ai/u/system)\
**Post date:** [April 11, 2022, 5:29pm UTC](https://community.wandb.ai/t/overriding-logged-media/1855/7 "2022-04-11T17:29:36Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
