Image arrays takes too long time to load in the frontend

Hi,

I logged some image arraies (imgaes created from matplotlib) in my project using wandb.log, but sometimes they take forever to show up in the Workspace interface (it just displays the loading symbol). I can see the images in the Files so they should have been corretly uploaded. The array is not very long (~ 10 images) so it shouldn’t take too much time to load. I think it should be a frontend bug. Is there any way to avoid this?

Hi @yongyi! Thank you for writing in.

Could you please send me a code snippet of you logging data to wandb?
Could you also send me a project where you are running into this behavior?

Would love to take a look into the behavior and then see if there is a workaround

Hi @artsiom ,

Thanks for the response!

Currently I find for example this run is taking a very long time to load the image (even just for one image). But well I’m not sure if it will still be loading when you see it …
Also, even when it is loading, I can directly see this image from the Files button so the image should have been uploaded.

In terms of the code, the complete code is kind of complicated but basically like this: I first trained a model, created a wandb run. Then (in another code) I load the data saved during training and make some figures, and I resume that wandb run and log the figures to that run as wandb.Image
The code snippet for logging the image is

    plt.figure(dpi = 256)
    plt.xlim(-4,6)
    plt.ylim(-4,6)

    _m_train_Y = m_train_Y.detach().cpu()
    _m_test_Y  = m_test_Y .detach().cpu()
    plt.scatter( _m_train_Y[:,0] , _m_train_Y[:,1] , s = 5 ,label = "train")
    plt.scatter( _m_test_Y[:,0]  , _m_test_Y[:,1]  , s = 20 ,label = "test", marker = "^")

    pred_Ys = []
    checkpoints = rec_G.summarize("checkpoints", lambda dic_check:[dic_check[_] for _ in dic_check])
    for epoch_idx in tqdm(checkpoints):
        model = rec_G.get_remote(f"saved_checkpoints/{epoch_idx}.pkl").to(C["device"]).eval()

        pred_Y = model(my_test_X).detach().cpu()[0]
        _, m_pred_Y = map_2d_identity(None , pred_Y, info, C["device"])

        pred_Ys.append(m_pred_Y)
    
    plt.scatter( [float(_[0]) for _ in pred_Ys][:1], [float(_[1]) for _ in pred_Ys][:1]  , s = 20   , c = "r"     , marker = "v"  ,label = "starting point")
    plt.plot(    [float(_[0]) for _ in pred_Ys]    , [float(_[1]) for _ in pred_Ys], markersize = 3 , c = "orange", marker = "o" , label = "model curve")

    plt.legend()
    plt.title(f"{rec_C['group']}/{rec_C['info']}")

I think it’s nothing new but just make some figures by matplotlib and log the image to a wandb run…

please let me know if you need more information!

Thank you so much for your swift and detailed response.

That is very strange that your images take a long time to show up. I wonder if you will be seeing the same behavior if you use our matplotlib integration with wandb. Could you please try uploading your mpl graphs this way?

Hi there, I wanted to follow up on this request. Please let us know if we can be of further assistance or if your issue has been resolved.

Hi Yongyi,

Since we have not heard back from you we are going to close this request. If you would like to re-open the conversation, please let us know!

Warmly,
Artsiom