@@ -727,8 +727,8 @@ def _copy_layers(hf_layers, pt_layers):
727
727
return hf_model
728
728
729
729
730
- def convert_ldm_clip_checkpoint (checkpoint ):
731
- text_model = CLIPTextModel .from_pretrained ("openai/clip-vit-large-patch14" )
730
+ def convert_ldm_clip_checkpoint (checkpoint , local_files_only = False ):
731
+ text_model = CLIPTextModel .from_pretrained ("openai/clip-vit-large-patch14" , local_files_only = local_files_only )
732
732
733
733
keys = list (checkpoint .keys ())
734
734
@@ -992,6 +992,7 @@ def download_from_original_stable_diffusion_ckpt(
992
992
controlnet : Optional [bool ] = None ,
993
993
load_safety_checker : bool = True ,
994
994
pipeline_class : DiffusionPipeline = None ,
995
+ local_files_only = False
995
996
) -> DiffusionPipeline :
996
997
"""
997
998
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(
1037
1038
Whether to load the safety checker or not. Defaults to `True`.
1038
1039
pipeline_class (`str`, *optional*, defaults to `None`):
1039
1040
The pipeline class to use. Pass `None` to determine automatically.
1041
+ local_files_only (`bool`, *optional*, defaults to `False`):
1042
+ Whether or not to only look at local files (i.e., do not try to download the model).
1040
1043
return: A StableDiffusionPipeline object representing the passed-in `.ckpt`/`.safetensors` file.
1041
1044
"""
1042
1045
@@ -1292,7 +1295,7 @@ def download_from_original_stable_diffusion_ckpt(
1292
1295
feature_extractor = feature_extractor ,
1293
1296
)
1294
1297
elif model_type == "FrozenCLIPEmbedder" :
1295
- text_model = convert_ldm_clip_checkpoint (checkpoint )
1298
+ text_model = convert_ldm_clip_checkpoint (checkpoint , local_files_only = local_files_only )
1296
1299
tokenizer = CLIPTokenizer .from_pretrained ("openai/clip-vit-large-patch14" )
1297
1300
1298
1301
if load_safety_checker :
0 commit comments