Skip to content

Commit 1ec988f

Browse files
SunMarcsayakpaul
andauthored
Update src/diffusers/configuration_utils.py
Co-authored-by: Sayak Paul <[email protected]>
1 parent d0a861c commit 1ec988f

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/diffusers/configuration_utils.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -360,19 +360,13 @@ def load_config(
360360
"`ConfigMixin`. Please make sure to define `config_name` in a class inheriting from `ConfigMixin`"
361361
)
362362
# Custom path for now
363-
if dduf_entries:
364363
if subfolder is not None:
365-
if os.path.join(pretrained_model_name_or_path, subfolder, cls.config_name) in dduf_entries:
366-
config_file = os.path.join(subfolder, cls.config_name)
367-
else:
368-
raise ValueError(
369-
f"We did not manage to find the file {os.path.join(pretrained_model_name_or_path, subfolder, cls.config_name)} in the dduf file. We only have the following files {dduf_entries.keys()}"
370-
)
371-
elif os.path.join(pretrained_model_name_or_path, cls.config_name) in dduf_entries:
372-
config_file = os.path.join(pretrained_model_name_or_path, cls.config_name)
364+
config_file = if os.path.join(pretrained_model_name_or_path, subfolder, cls.config_name) in dduf_entries
373365
else:
366+
config_file = if os.path.join(pretrained_model_name_or_path, cls.config_name)
367+
if config_filepath not in dduf_entries:
374368
raise ValueError(
375-
f"We did not manage to find the file {os.path.join(pretrained_model_name_or_path, cls.config_name)} in the dduf file. We only have the following files {dduf_entries.keys()}"
369+
f"We did not manage to find the file {os.path.join(pretrained_model_name_or_path, subfolder, cls.config_name)} in the dduf file. We only have the following files {dduf_entries.keys()}"
376370
)
377371
elif os.path.isfile(pretrained_model_name_or_path):
378372
config_file = pretrained_model_name_or_path

0 commit comments

Comments
 (0)