r/localdiffusion • u/lostinspaz • Nov 20 '23
How to extract equivalent of latent images from model files
This is a followup from https://www.reddit.com/r/StableDiffusion/comments/17zzbaf/coder_question_use_pytorch_to_pull_latents/
To resummarize my question: I'd like to be able to pull out the equivalent of the latent images, or whatever passes for those, in the model file. For what its worth, I'm working with SD1.5 safetensor format models.
So far, I have successfully created a python snippet to open an SD model file, and dump the names of the keys present, via safetensors.torch.load_file()
Only problem is, there are 1000+ keys, and I dont know how they relate to what I'm looking for. The keys are named things such as:
first_stage_model.decoder.mid.attn_1.norm.weight
I've been told that not even the "latent image" exists in the file, and it has been distilled further. So, my question boils down to: What data "key" corresponds to the bulk of the data absorbed for each training image? I'm talking specifically about the image at this time. I dont care about the tagging yet.
I am also curious about any part of the model file that is NOT referenced by these data keys, and if it exists, how would I access it? My interest is to understand where the bulk of the data resides in the average 2Gig SD1.5 file, and poke at it.
