feat: backward compatibility for SD/SDXL latent cache#2276
Conversation
|
In #2269, if the user sets a resolution (for example 512) and the cached latent without resolution suffix is different (for example 768), then I think this is a good default behavior and we don't need to show error or warning in this case. Just like the case if the user sets resolution 512 and the cached latent has resolution suffix 768/8 , then we compute the new latent and add it to the npz file with suffix 512/8, without error or warning. The old latent will not be removed, and it will be used when the user wants to train again with resolution 768. If the user feels out of disk space, they can manually remove the npz files. After this PR, the training script shows a warning and loads the latent 768 (not 512). Is it what you intend to do? |
|
Thank you, you have a point. However, I would like to avoid behavior changes when applying a PR. Before #2269 was applied, if the user set a resolution (e.g., 512) and the cached latent (without the resolution suffix) were different (e.g., 768), However, this is probably not what you want, so we're displaying a warning. In any case, this use of a different size latent only occurs in the rare case of a mismatch between the cached latent size and the latent size derived from the current dataset, so it seems simpler to just reproduce the previous behavior rather than checking the size using npz's internal API. |
|
I see, now this PR looks good to me. |
|
Thank you for your understanding and for your review! And many thanks again for submitting the original PR. |
Prior to #2269, no error was raised if a latent without a resolution suffix differed from the expected latent shape (which occurs when the user defines multiple resolution datasets in the same cache directory). This PR implements that behavior for backward compatibility.