Skip to content

Commit 1c14ce9

Browse files
fix local subfolder
1 parent 29628ac commit 1c14ce9

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/diffusers/configuration_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ def get_config_dict(
134134
if os.path.isfile(os.path.join(pretrained_model_name_or_path, cls.config_name)):
135135
# Load from a PyTorch checkpoint
136136
config_file = os.path.join(pretrained_model_name_or_path, cls.config_name)
137+
elif subfolder is not None and os.path.isfile(
138+
os.path.join(pretrained_model_name_or_path, subfolder, cls.config_name)
139+
):
140+
config_file = os.path.join(pretrained_model_name_or_path, subfolder, cls.config_name)
137141
else:
138142
raise EnvironmentError(
139143
f"Error no file named {cls.config_name} found in directory {pretrained_model_name_or_path}."

src/diffusers/modeling_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,10 @@ def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.P
348348
if os.path.isfile(os.path.join(pretrained_model_name_or_path, WEIGHTS_NAME)):
349349
# Load from a PyTorch checkpoint
350350
model_file = os.path.join(pretrained_model_name_or_path, WEIGHTS_NAME)
351+
elif subfolder is not None and os.path.isfile(
352+
os.path.join(pretrained_model_name_or_path, subfolder, WEIGHTS_NAME)
353+
):
354+
model_file = os.path.join(pretrained_model_name_or_path, subfolder, WEIGHTS_NAME)
351355
else:
352356
raise EnvironmentError(
353357
f"Error no file named {WEIGHTS_NAME} found in directory {pretrained_model_name_or_path}."

src/diffusers/schedulers/scheduling_pndm.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,9 @@ def get_prev_sample(self, sample, t_orig, t_orig_prev, model_output):
214214
) ** (0.5)
215215

216216
# full formula (9)
217-
prev_sample = sample_coeff * sample - (alpha_prod_t_prev - alpha_prod_t) * model_output / model_output_denom_coeff
217+
prev_sample = (
218+
sample_coeff * sample - (alpha_prod_t_prev - alpha_prod_t) * model_output / model_output_denom_coeff
219+
)
218220

219221
return prev_sample
220222

0 commit comments

Comments
 (0)