Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
326172d
Add timestep_spacing to DDPM, LMSDiscrete, PNDM.
pcuenca Jul 3, 2023
9ac281b
Remove spurious line.
pcuenca Jul 3, 2023
77075af
More easy schedulers.
pcuenca Jul 3, 2023
5e3c4f7
Add `linspace` to DDIM
pcuenca Jul 3, 2023
c1e93d2
Noise sigma for `trailing`.
pcuenca Jul 3, 2023
cd4cc28
Add timestep_spacing to DEISMultistepScheduler.
pcuenca Jul 3, 2023
02cdd87
Fix: remove line used to debug.
pcuenca Jul 3, 2023
30e3a5d
Support timestep_spacing in DPMSolverMultistep, DPMSolverSDE, UniPC
pcuenca Jul 3, 2023
8375d0a
Fix: convert to numpy.
pcuenca Jul 3, 2023
eb60db4
Use sched. defaults when instantiating from_config
pcuenca Jul 3, 2023
81c5a1e
Apply suggestions from code review
pcuenca Jul 4, 2023
a38021f
Missing args in DPMSolverMultistep
pcuenca Jul 4, 2023
8f9c73c
Test: default args not in config
pcuenca Jul 4, 2023
d833276
Style
pcuenca Jul 4, 2023
3de3909
Fix scheduler name in test
pcuenca Jul 4, 2023
5080d7f
Remove duplicated entries
pcuenca Jul 4, 2023
083c8aa
Add test for solver_type
pcuenca Jul 4, 2023
bef7669
UniPC: use same default for solver_type
pcuenca Jul 4, 2023
21d7eea
do not save use default values
patrickvonplaten Jul 5, 2023
cb1109f
fix more
patrickvonplaten Jul 5, 2023
46c5c8f
fix all
patrickvonplaten Jul 5, 2023
dc8c70b
fix schedulers
patrickvonplaten Jul 5, 2023
6470353
fix more
patrickvonplaten Jul 5, 2023
72949cb
finish for real
patrickvonplaten Jul 5, 2023
45328ef
finish for real
patrickvonplaten Jul 5, 2023
8f4c443
flaky tests
patrickvonplaten Jul 5, 2023
cedcb1b
Update tests/pipelines/stable_diffusion/test_stable_diffusion_pix2pix…
patrickvonplaten Jul 5, 2023
a8bdf06
Default steps_offset to 0.
pcuenca Jul 5, 2023
f5a1d2c
Add missing docstrings
pcuenca Jul 5, 2023
910d609
Apply suggestions from code review
patrickvonplaten Jul 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/diffusers/configuration_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,8 @@ def extract_init_dict(cls, config_dict, **kwargs):
hidden_config_dict = {k: v for k, v in original_dict.items() if k not in init_dict}

# 8. Take note of the parameters that were not present in the loaded config
hidden_config_dict["_use_default_values"] = expected_keys - set(init_dict)
if len(expected_keys - set(init_dict)) > 0:
hidden_config_dict["_use_default_values"] = expected_keys - set(init_dict)

return init_dict, unused_kwargs, hidden_config_dict

Expand Down
3 changes: 0 additions & 3 deletions src/diffusers/schedulers/scheduling_euler_discrete.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,6 @@ def __init__(
sigmas = np.concatenate([sigmas[::-1], [0.0]]).astype(np.float32)
self.sigmas = torch.from_numpy(sigmas)

# standard deviation of the initial noise distribution
self.init_noise_sigma = self.sigmas.max()

# setable values
self.num_inference_steps = None
timesteps = np.linspace(0, num_train_timesteps - 1, num_train_timesteps, dtype=float)[::-1].copy()
Expand Down
34 changes: 34 additions & 0 deletions tests/others/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,22 @@ def __init__(
pass


class SampleObject4(ConfigMixin):
config_name = "config.json"

@register_to_config
def __init__(
self,
a=2,
b=5,
c=(2, 5),
d="for diffusion",
e=[1, 5],
f=[5, 4],
):
pass


class ConfigTester(unittest.TestCase):
def test_load_not_from_mixin(self):
with self.assertRaises(ValueError):
Expand Down Expand Up @@ -233,3 +249,21 @@ def test_load_dpmsolver(self):
assert dpm.__class__ == DPMSolverMultistepScheduler
# no warning should be thrown
assert cap_logger.out == ""

def test_use_default_values(self):
# let's first save a config that should be in the form
# a=2,
# b=5,
# c=(2, 5),
# d="for diffusion",
# e=[1, 3],

config = SampleObject()
with tempfile.TemporaryDirectory() as tmpdirname:
config.save(tmpdirname)

# now loading it with SampleObject2 should put f into `_use_default_values`
config = SampleObject2.from_config(tmpdirname)

assert "f" in config._use_default_values
assert config.f == [1, 4]