OSError: Error no file named config.json found in directory stabilityai/stable-diffusion-xl-refiner-1.0/.

#31
by torchCoder - opened

when run
import torch
from diffusers import StableDiffusionXLImg2ImgPipeline
from diffusers.utils import load_image

pipe = StableDiffusionXLImg2ImgPipeline.from_pretrained(
"stabilityai/stable-diffusion-xl-refiner-1.0/", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
)
pipe = pipe.to("cuda")
url = "https://huggingface.co/datasets/patrickvonplaten/images/resolve/main/aa_xl/000000009.png"

init_image = load_image(url).convert("RGB")
prompt = "a photo of an astronaut riding a horse on mars"
image = pipe(prompt, image=init_image).images


OSError Traceback (most recent call last)
Cell In[4], line 5
2 from diffusers import StableDiffusionXLImg2ImgPipeline
3 from diffusers.utils import load_image
----> 5 pipe = StableDiffusionXLImg2ImgPipeline.from_pretrained(
6 "stabilityai/stable-diffusion-xl-refiner-1.0/", torch_dtype=torch.float16, variant="fp16", use_safetensors=True
7 )
8 pipe = pipe.to("cuda")
9 url = "https://huggingface.co/datasets/patrickvonplaten/images/resolve/main/aa_xl/000000009.png"

File ~/.conda/envs/diffuser_python/lib/python3.9/site-packages/diffusers/pipelines/pipeline_utils.py:1093, in DiffusionPipeline.from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
1090 loaded_sub_model = passed_class_obj[name]
1091 else:
1092 # load sub model
-> 1093 loaded_sub_model = load_sub_model(
1094 library_name=library_name,
1095 class_name=class_name,
1096 importable_classes=importable_classes,
1097 pipelines=pipelines,
1098 is_pipeline_module=is_pipeline_module,
1099 pipeline_class=pipeline_class,
1100 torch_dtype=torch_dtype,
1101 provider=provider,
1102 sess_options=sess_options,
1103 device_map=device_map,
1104 max_memory=max_memory,
1105 offload_folder=offload_folder,
1106 offload_state_dict=offload_state_dict,
1107 model_variants=model_variants,
1108 name=name,
1109 from_flax=from_flax,
1110 variant=variant,
1111 low_cpu_mem_usage=low_cpu_mem_usage,
1112 cached_folder=cached_folder,
1113 )
1114 logger.info(
1115 f"Loaded {name} as {class_name} from {name} subfolder of {pretrained_model_name_or_path}."
1116 )
1118 init_kwargs[name] = loaded_sub_model # UNet(...), # DiffusionSchedule(...)

File ~/.conda/envs/diffuser_python/lib/python3.9/site-packages/diffusers/pipelines/pipeline_utils.py:470, in load_sub_model(library_name, class_name, importable_classes, pipelines, is_pipeline_module, pipeline_class, torch_dtype, provider, sess_options, device_map, max_memory, offload_folder, offload_state_dict, model_variants, name, from_flax, variant, low_cpu_mem_usage, cached_folder)
467 loaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs)
468 else:
469 # else load from the root directory
--> 470 loaded_sub_model = load_method(cached_folder, **loading_kwargs)
472 return loaded_sub_model

File ~/.conda/envs/diffuser_python/lib/python3.9/site-packages/diffusers/models/modeling_utils.py:528, in ModelMixin.from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
521 user_agent = {
522 "diffusers": version,
523 "file_type": "model",
524 "framework": "pytorch",
525 }
527 # load config
--> 528 config, unused_kwargs, commit_hash = cls.load_config(
529 config_path,
530 cache_dir=cache_dir,
531 return_unused_kwargs=True,
532 return_commit_hash=True,
533 force_download=force_download,
534 resume_download=resume_download,
535 proxies=proxies,
536 local_files_only=local_files_only,
537 use_auth_token=use_auth_token,
538 revision=revision,
539 subfolder=subfolder,
540 device_map=device_map,
541 max_memory=max_memory,
542 offload_folder=offload_folder,
543 offload_state_dict=offload_state_dict,
544 user_agent=user_agent,
545 **kwargs,
546 )
548 # load model
549 model_file = None

File ~/.conda/envs/diffuser_python/lib/python3.9/site-packages/diffusers/configuration_utils.py:364, in ConfigMixin.load_config(cls, pretrained_model_name_or_path, return_unused_kwargs, return_commit_hash, **kwargs)
362 config_file = os.path.join(pretrained_model_name_or_path, subfolder, cls.config_name)
363 else:
--> 364 raise EnvironmentError(
365 f"Error no file named {cls.config_name} found in directory {pretrained_model_name_or_path}."
366 )
367 else:
368 try:
369 # Load from URL or cache if already cached

OSError: Error no file named config.json found in directory stabilityai/stable-diffusion-xl-refiner-1.0/.

Sign up or log in to comment