Skip to content
This repository was archived by the owner on Feb 7, 2025. It is now read-only.

Commit 6c8fbe9

Browse files
authored
Fix format (#250)
Signed-off-by: Walter Hugo Lopez Pinaya <ianonimato@hotmail.com>
1 parent 6206021 commit 6c8fbe9

File tree

5 files changed

+7
-5
lines changed

5 files changed

+7
-5
lines changed

generative/networks/nets/autoencoderkl.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,9 @@ def __init__(
612612
num_res_blocks = ensure_tuple_rep(num_res_blocks, len(num_channels))
613613

614614
if len(num_res_blocks) != len(num_channels):
615-
raise ValueError("`num_res_blocks` should be a single integer or a tuple of integers with the same length as `num_channels`.")
615+
raise ValueError(
616+
"`num_res_blocks` should be a single integer or a tuple of integers with the same length as `num_channels`."
617+
)
616618

617619
self.encoder = Encoder(
618620
spatial_dims=spatial_dims,

generative/networks/nets/diffusion_model_unet.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1655,7 +1655,9 @@ def __init__(
16551655
num_res_blocks = ensure_tuple_rep(num_res_blocks, len(num_channels))
16561656

16571657
if len(num_res_blocks) != len(num_channels):
1658-
raise ValueError("`num_res_blocks` should be a single integer or a tuple of integers with the same length as `num_channels`.")
1658+
raise ValueError(
1659+
"`num_res_blocks` should be a single integer or a tuple of integers with the same length as `num_channels`."
1660+
)
16591661

16601662
self.in_channels = in_channels
16611663
self.block_out_channels = num_channels

generative/networks/schedulers/ddim.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ def __init__(
103103
# standard deviation of the initial noise distribution
104104
self.init_noise_sigma = 1.0
105105

106-
107106
self.timesteps = torch.from_numpy(np.arange(0, num_train_timesteps)[::-1].astype(np.int64))
108107

109108
self.clip_sample = clip_sample

generative/networks/schedulers/pndm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ def __init__(
117117
self.cur_sample = None
118118
self.ets = []
119119

120-
121120
self._timesteps = np.arange(0, num_train_timesteps)[::-1].copy()
122121

123122
# default the number of inference timesteps to the number of train steps
124123
self.set_timesteps(num_train_timesteps)
124+
125125
def set_timesteps(self, num_inference_steps: int, device: str | torch.device | None = None) -> None:
126126
"""
127127
Sets the discrete timesteps used for the diffusion chain. Supporting function to be run before inference.

tests/test_scheduler_pndm.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ def test_add_noise_2d_shape(self, input_param, input_shape, expected_shape):
3939
noisy = scheduler.add_noise(original_samples=original_sample, noise=noise, timesteps=timesteps)
4040
self.assertEqual(noisy.shape, expected_shape)
4141

42-
4342
@parameterized.expand(TEST_CASES)
4443
def test_step_shape(self, input_param, input_shape, expected_shape):
4544
scheduler = PNDMScheduler(**input_param)

0 commit comments

Comments
 (0)