# Load custom UNet2DConditionModel takes too long

**URL:** <https://discuss.huggingface.co/t/load-custom-unet2dconditionmodel-takes-too-long/65711>\
**Category:** 🧨 Diffusers\
**Created:** [December 13, 2023, 6:49pm UTC](https://discuss.huggingface.co/t/load-custom-unet2dconditionmodel-takes-too-long/65711 "2023-12-13T18:49:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AeroDEmi](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@AeroDEmi](https://discuss.huggingface.co/u/AeroDEmi)\
**Post date:** [December 13, 2023, 6:49pm UTC](https://discuss.huggingface.co/t/load-custom-unet2dconditionmodel-takes-too-long/65711/1 "2023-12-13T18:49:12Z")

</div>

I’m loading a UNet2DConditionModel safe-tensors which are results from [this text\_to\_image](https://github.com/huggingface/diffusers/tree/main/examples/text_to_image) training. The code takes way too long to load.

```auto
unet = UNet2DConditionModel.from_pretrained('checkpoint-3000', subfolder='unet_ema', use_safetensors=True, torch_dtype=torch.float16)
pipe = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", unet=unet, torch_dtype=torch.float16, use_safetensors=True)

```

Is there something wrong with my installation or my code?
