Load a pytorch .pt file of a Unet/UnetCond Model with diffusers Conv2D and implement in Stable Diffusion Pipeline

We can use this model = UNet2DConditionModel.from_pretrained('path_to_model') to load a Unet model and then we can put this in a DiffusionPipeline.

I have trained a Unet from scratch in Pytorch with Conv2d(in_channels, out_channels, kernel_size, etc) and saved it into a .pt file.

Is there a way where I can load this .pt file in diffusers UNet2DConditionModel.from_pretrained('path_to_.pt_file') and then add it into the pipeline?

Hey @pranked03 I’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