Skip to content

Commit

Permalink
[From Single File] Allow Text Encoder to be passed (huggingface#6020)
Browse files Browse the repository at this point in the history
Allow text encoder to be passed
  • Loading branch information
patrickvonplaten authored Dec 1, 2023
1 parent af378c1 commit bc1d28c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit bc1d28c

Please sign in to comment.