# Problem loading pretrained model that exists

**URL:** <https://discuss.huggingface.co/t/problem-loading-pretrained-model-that-exists/31074>\
**Category:** 🧨 Diffusers\
**Created:** [February 3, 2023, 7:59pm UTC](https://discuss.huggingface.co/t/problem-loading-pretrained-model-that-exists/31074 "2023-02-03T19:59:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alpha-Romeo](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/alpha-romeo/32/13972_2.png) [@Alpha-Romeo](https://discuss.huggingface.co/u/Alpha-Romeo)\
**Post date:** [February 3, 2023, 7:59pm UTC](https://discuss.huggingface.co/t/problem-loading-pretrained-model-that-exists/31074/1 "2023-02-03T19:59:12Z")

</div>

Hi,

Im trying to load the image encoder from this repository

> **[Fantasy-Studio/Paint-by-Example at main](https://huggingface.co/Fantasy-Studio/Paint-by-Example/tree/main/image_encoder)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

Using this line of code:

> image\_encoder = PaintByExampleImageEncoder.from\_pretrained(“Fantasy-Studio/Paint-by-Example”, subfolder=“image\_encoder”)

However I get the error:  
OSError: Fantasy-Studio/Paint-by-Example does not appear to have a file named config.json.

Even though clearly there is one there in the above link. What is wrong?

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](https://discuss.huggingface.co/u/radames)\
**Post date:** [February 3, 2023, 10:50pm UTC](https://discuss.huggingface.co/t/problem-loading-pretrained-model-that-exists/31074/2 "2023-02-03T22:50:51Z")

</div>

hi @Alpha-Romeo ,

I think you can do this, where you need to explicitly pass CLIP config

```python
from diffusers.pipelines.paint_by_example import PaintByExampleImageEncoder
from transformers import CLIPVisionConfig

config = CLIPVisionConfig.from_pretrained("openai/clip-vit-large-patch14")
image_encoder = PaintByExampleImageEncoder(config)

```

---

<div class="post-metadata">

**Author:** ![Alpha-Romeo](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/alpha-romeo/32/13972_2.png) [@Alpha-Romeo](https://discuss.huggingface.co/u/Alpha-Romeo)\
**Post date:** [February 6, 2023, 4:23pm UTC](https://discuss.huggingface.co/t/problem-loading-pretrained-model-that-exists/31074/3 "2023-02-06T16:23:25Z")

</div>

Thanks, this resolved the error!
