From bc1d28c88873bef8c44a5b42ba3a3db975cbb3e5 Mon Sep 17 00:00:00 2001 From: Patrick von Platen Date: Fri, 1 Dec 2023 16:19:04 +0100 Subject: [PATCH] [From Single File] Allow Text Encoder to be passed (#6020) Allow text encoder to be passed --- .../pipelines/stable_diffusion/convert_from_ckpt.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py b/src/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py index 35466f008f54..30eb8d2ceafc 100644 --- a/src/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py +++ b/src/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py @@ -1480,9 +1480,12 @@ def download_from_original_stable_diffusion_ckpt( config_name = "stabilityai/stable-diffusion-2" config_kwargs = {"subfolder": "text_encoder"} - text_model = convert_open_clip_checkpoint( - checkpoint, config_name, local_files_only=local_files_only, **config_kwargs - ) + if text_encoder is None: + text_model = convert_open_clip_checkpoint( + checkpoint, config_name, local_files_only=local_files_only, **config_kwargs + ) + else: + text_model = text_encoder try: tokenizer = CLIPTokenizer.from_pretrained(