New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Q] Log image per epoch and have slider per epoch #3455
Comments
Hi @azinonos, Images (or for that matter any data logged through To answer your question, there are 2 ways to manage the step number:
wandb.log({
'metric_1' : ...,
'metric_2' : ...
}) vs wandb.log({'metric_1' : ...})
wandb.log({'metric_2' : ...})
As for your second question, the images are always ordered in the order in which they are logged to W&B. There is no way to rearrange this order currently. Thanks, |
Hi Ramit, Thanks for the response. For the second solution, when you set a manual step with step=STEP, does this affect all steps on a global scope? Or just for this specific metric? Regarding the logging order, I do log them in a specific order monotonically, but they end up getting logged randomly - that's the problem. |
Hey @azinonos, When you set a manual step, it only defines the step value for that particular call to Would it be possible for you to share a minimal script or colab link reproducing the issue where images are not in order? It will help me understand why these images are not ordered correctly for you. Thanks, |
Hi Ramit, |
Hi @azinonos, Just wanted to follow up here, were you able to set up a reproduction of the error you were seeing with unordered images? It will help me figure out the underlying cause of the bug here. Thanks, |
Hi Ramit, I've just set up a demo now. If you run this, you can see that the logged figures are in a jumbled order. If you try to sort them, you can see it sorts them in an odd way as if the integer is a string instead of numerically (eg. 1,11,12,13..,2, 21). https://colab.research.google.com/drive/1QobUjeysZE2DHurQoKTBnBd79CcrsegT?usp=sharing Also setting step=STEP does not seem to work for me, I get the below warning and wandb does not plot anything at all: |
Hi @azinonos, Thanks for the reproduction! I have requested access so that I can look into this. As for the warning you see, this is what I meant by Thanks, |
Hi @ramit-wandb, I've given you access to the Google Colab. Regarding the error, I thought the step value is local in which case I could log a new monotonically increasing value every time I log the image (0, 1, 2 etc). Getting this error means the step value is actually global, so it gives me this error because wandb has already performed logs in other parts of the program and it has already incremented the counter to a high value (eg. 2727). If this is indeed the case, how could I use it to log this specific image no_epochs time and not get this error? |
Hey @azinonos, I looked through your colab, Looks like you are logging each image with a different key : Thanks, |
Ramit Goolry commented: We wanted to follow up with you regarding your support request as we have not heard back from you. Please let us know if we can be of further assistance or if your issue has been resolved. Best, |
Hi @ramit-wandb , If I log them with the same key then I have the initial problem of having a slider which is not the number of epochs but a random step. The reason why I'm using the different key is so that I can have them in a manual order I can control. |
WandB Internal User commented: If I log them with the same key then I have the initial problem of having a slider which is not the number of epochs but a random step. The reason why I'm using the different key is so that I can have them in a manual order I can control. |
Ah, I see what you mean. Currently, there is no way to switch step out for another metric, since we use step to internally track when a metric is logged. If you really need to make sure that you see epoch at the bottom of your metric, for now I will suggest only making one call to Thanks, |
Ramit Goolry commented: We wanted to follow up with you regarding your support request as we have not heard back from you. Please let us know if we can be of further assistance or if your issue has been resolved. Best, |
Ramit Goolry commented: |
Hi @ramit-wandb , sorry for the late response. To be honest this hasn't really been resolved, the issue still remains that a) You can use a custom x-axis with the epochs and b) when you log things independently, you can't sort those images in a specific order. These would be features for wandb to implement. |
Hi @azinonos, I have created a feature request to allow for custom sliders for a given media object. I'll keep you updated on the status of its progress! Thanks, |
Hey both! I'm having the same issue logging images with wandb (0.13.10) and pytorch lightning (1.8.6). The "step" on the slider of the logged images are not aligned with the other metrics which use Would it be possible for the slider to display the step specified as an argument, instead of the internal step count from the logger? |
@anthonyhu if you have defined teh Could you provide some more details about what you are seeing, specifically, how are you setting Thanks, |
I see what you mean, could you share a link to your project? There is no way to change the axis of the media panel currently, though that is something we have roadmapped for the future.
|
Thank you for the answer! I cannot share the project as it is a private one. |
I can understand. In that case I will be bumping up the priority for this request in our internal system. I'll reach out once I have some updates for you regarding this. Thanks, |
Thank you so much 🙏 |
A workaround for the PyTorchLightning usecase:
Example:
Using that approach all metrics and figures will be saved for the same step, which increases every time |
Thank you for the workaround! |
@ramit-wandb I also have a similar issue related to logging images with a custom step. I have: wandb_context.define_metric(f"{root_name}*", step_metric="global_step")
# ...
wandb_context.log({f"{root_name}/loss": loss.item(), "global_step": step})
# ...
wandb_context.log(
{
f"{root_name}/target_heatmap": [
wandb_context.Image(target_heatmap, caption="Target heatmap")
],
"global_step": step,
}
) Using the exact same It important to note that this is only a subset example, all of the non-image metrics track with global_step, while all of the image metrics/logs track the internal step. Version: Name: wandb
Version: 0.14.0 |
WandB Internal User commented:
|
Hello,
In my training loop I am logging an image generated from the data at every epoch. I am using PyTorch Lightning and Weights & Biases. The command I'm using is like the below:
However, when I log it to wandb, I get a weird slider which is not epochs but random steps. For example the first step is step 14, the second is step 19, the third is step 24 etc. So even though I can slide the slider to see the progress, I never really know which epoch each image corresponds to.
Alternatively, I tried to log multiple images (which is an uglier way) by putting the current epoch number as part of the title:
This logs multiple images with the epoch number, but does so in a seemingly arbitrary order. If I use the sorting functionality, I still don't get a correct sorting of the images, but a different arbitrary combination.
So to summarise:
Question/Issue 1) How to log images on every epoch and have a slider epoch instead of random steps?
Question/Issue 2) How to sort multiple images in a correct order instead of arbitrarily?
The text was updated successfully, but these errors were encountered: