Skip to content

Commit 73e81a5

Browse files
committed
more readable condition
1 parent 7486016 commit 73e81a5

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/diffusers/configuration_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ def load_config(
364364
if subfolder is not None:
365365
raise ValueError("DDUF file only allow for 1 level of directory. Please check the DDUF structure")
366366
# paths inside a DDUF file must always be "/"
367-
config_file = "/".join([pretrained_model_name_or_path, cls.config_name])
367+
config_file = cls.config_name if pretrained_model_name_or_path == "" else "/".join([pretrained_model_name_or_path, cls.config_name])
368368
if config_file not in dduf_entries:
369369
raise ValueError(
370370
f"We did not manage to find the file {config_file} in the dduf file. We only have the following files {dduf_entries.keys()}"

src/diffusers/utils/hub_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,9 @@ def _get_model_file(
299299
if dduf_entries:
300300
if subfolder is not None:
301301
raise ValueError("DDUF file only allow for 1 level of directory. Please check the DDUF structure")
302-
if "/".join([pretrained_model_name_or_path, weights_name]) in dduf_entries:
303-
return "/".join([pretrained_model_name_or_path, weights_name])
302+
model_file = weights_name if pretrained_model_name_or_path == "" else "/".join([pretrained_model_name_or_path, weights_name])
303+
if model_file in dduf_entries:
304+
return model_file
304305
else:
305306
raise EnvironmentError(f"Error no file named {weights_name} found in archive {dduf_entries.keys()}.")
306307
elif os.path.isfile(pretrained_model_name_or_path):

0 commit comments

Comments
 (0)