Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
diffusers
Commits
0160e514
Unverified
Commit
0160e514
authored
May 22, 2023
by
w4ffl35
Committed by
GitHub
May 22, 2023
Browse files
Adds local_files_only bool to prevent forced online connection (#3486)
parent
194b0a42
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
src/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py
...diffusers/pipelines/stable_diffusion/convert_from_ckpt.py
+6
-3
No files found.
src/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py
View file @
0160e514
...
...
@@ -727,8 +727,8 @@ def convert_ldm_bert_checkpoint(checkpoint, config):
return
hf_model
def
convert_ldm_clip_checkpoint
(
checkpoint
):
text_model
=
CLIPTextModel
.
from_pretrained
(
"openai/clip-vit-large-patch14"
)
def
convert_ldm_clip_checkpoint
(
checkpoint
,
local_files_only
=
False
):
text_model
=
CLIPTextModel
.
from_pretrained
(
"openai/clip-vit-large-patch14"
,
local_files_only
=
local_files_only
)
keys
=
list
(
checkpoint
.
keys
())
...
...
@@ -992,6 +992,7 @@ def download_from_original_stable_diffusion_ckpt(
controlnet
:
Optional
[
bool
]
=
None
,
load_safety_checker
:
bool
=
True
,
pipeline_class
:
DiffusionPipeline
=
None
,
local_files_only
=
False
)
->
DiffusionPipeline
:
"""
Load a Stable Diffusion pipeline object from a CompVis-style `.ckpt`/`.safetensors` file and (ideally) a `.yaml`
...
...
@@ -1037,6 +1038,8 @@ def download_from_original_stable_diffusion_ckpt(
Whether to load the safety checker or not. Defaults to `True`.
pipeline_class (`str`, *optional*, defaults to `None`):
The pipeline class to use. Pass `None` to determine automatically.
local_files_only (`bool`, *optional*, defaults to `False`):
Whether or not to only look at local files (i.e., do not try to download the model).
return: A StableDiffusionPipeline object representing the passed-in `.ckpt`/`.safetensors` file.
"""
...
...
@@ -1292,7 +1295,7 @@ def download_from_original_stable_diffusion_ckpt(
feature_extractor
=
feature_extractor
,
)
elif
model_type
==
"FrozenCLIPEmbedder"
:
text_model
=
convert_ldm_clip_checkpoint
(
checkpoint
)
text_model
=
convert_ldm_clip_checkpoint
(
checkpoint
,
local_files_only
=
local_files_only
)
tokenizer
=
CLIPTokenizer
.
from_pretrained
(
"openai/clip-vit-large-patch14"
)
if
load_safety_checker
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment