Load a pytorch .pt file of a Unet/UnetCond Model with diffusers Conv2D and implement in Stable Diffusion Pipeline
We can use thismodel = UNet2DConditionModel.from_pretrained('path_to_model')to load a Unet model and then we can put this in aDiffusionPipeline.I have trained a Unet from scratch in Pytorch withConv2d(in_channels, out_channels, kernel_size, etc)and saved it into a.ptfile.Is there a way where I can load this.ptfile in diffusersUNet2DConditionModel.from_pretrained('path_to_.pt_file')and then add it into the pipeline?
2023-03-16T23:43:16Z
Hey@pranked03I’m not sure I follow. Was the unet trained as a part of diffusers? If so and the weights are of the same format used in the diffusers unet, you should be able to use the standard pytorch weight loading methods on the pytorch checkpoint
2023-03-31T05:31:59Z
No. I trained the unet of a diffusion model I made from scratch. So its a separate .pt file. Is it possible to load that unet model into the diffusers library?
2023-04-28T16:46:16Z
hey@pranked03sorry for the delay here, we can’t guarantee that you’ll be able to load it into diffusers. You’ll have to do the leg work yourself to convert the weights