Skip to content

Commit 8f0f383

Browse files
pre-commit-ci[bot]neggles
authored andcommitted
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent b8dcb80 commit 8f0f383

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

src/neurosis/models/text_encoder/clip_t5.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ def __init__(
2222
self.clip_encoder = FrozenCLIPEmbedder(clip_version, device, max_length=clip_max_length)
2323
self.t5_encoder = FrozenT5Embedder(t5_version, device, max_length=t5_max_length)
2424
logger.info(
25-
f"{self.clip_encoder.__class__.__name__} has {count_params(self.clip_encoder) * 1.e-6:.2f} M parameters, "
26-
f"{self.t5_encoder.__class__.__name__} comes with {count_params(self.t5_encoder) * 1.e-6:.2f} M params."
25+
f"{self.clip_encoder.__class__.__name__} has {count_params(self.clip_encoder) * 1.0e-6:.2f} M parameters, "
26+
f"{self.t5_encoder.__class__.__name__} comes with {count_params(self.t5_encoder) * 1.0e-6:.2f} M params."
2727
)
2828

2929
def encode(self, text):

src/neurosis/modules/autoencoding/regularizers/quantize.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ def __init__(
101101
self.unknown_index = self.re_embed
102102
self.re_embed = self.re_embed + 1
103103
else:
104-
assert unknown_index == "random" or isinstance(
105-
unknown_index, int
106-
), "unknown index needs to be 'random', 'extra' or any integer"
104+
assert unknown_index == "random" or isinstance(unknown_index, int), (
105+
"unknown index needs to be 'random', 'extra' or any integer"
106+
)
107107
self.unknown_index = unknown_index # "random" or "extra" or integer
108108
if self.remap is not None:
109109
logpy.info(
@@ -206,9 +206,9 @@ def __init__(
206206
self.unknown_index = self.re_embed
207207
self.re_embed = self.re_embed + 1
208208
else:
209-
assert unknown_index == "random" or isinstance(
210-
unknown_index, int
211-
), "unknown index needs to be 'random', 'extra' or any integer"
209+
assert unknown_index == "random" or isinstance(unknown_index, int), (
210+
"unknown index needs to be 'random', 'extra' or any integer"
211+
)
212212
self.unknown_index = unknown_index # "random" or "extra" or integer
213213
if self.remap is not None:
214214
logpy.info(
@@ -349,9 +349,9 @@ def __init__(
349349
self.unknown_index = self.re_embed
350350
self.re_embed = self.re_embed + 1
351351
else:
352-
assert unknown_index == "random" or isinstance(
353-
unknown_index, int
354-
), "unknown index needs to be 'random', 'extra' or any integer"
352+
assert unknown_index == "random" or isinstance(unknown_index, int), (
353+
"unknown index needs to be 'random', 'extra' or any integer"
354+
)
355355
self.unknown_index = unknown_index # "random" or "extra" or integer
356356
if self.remap is not None:
357357
logpy.info(

src/neurosis/modules/diffusion/openaimodel.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,9 @@ def __init__(
362362
if num_head_channels == -1:
363363
self.num_heads = num_heads
364364
else:
365-
assert (
366-
channels % num_head_channels == 0
367-
), f"q,k,v channels {channels} is not divisible by num_head_channels {num_head_channels}"
365+
assert channels % num_head_channels == 0, (
366+
f"q,k,v channels {channels} is not divisible by num_head_channels {num_head_channels}"
367+
)
368368
self.num_heads = channels // num_head_channels
369369
self.use_checkpoint = use_checkpoint
370370
self.norm = nn.GroupNorm(channels)

src/neurosis/schedulers/cosine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def get_lr(self):
9090

9191
if not self._get_lr_called_within_step:
9292
warnings.warn(
93-
"To get the last learning rate computed by the scheduler, " "please use `get_last_lr()`."
93+
"To get the last learning rate computed by the scheduler, please use `get_last_lr()`."
9494
)
9595

9696
if n < 0:

src/neurosis/schedulers/linear.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def schedule(self, n, **kwargs):
4747
cycle = self.find_in_interval(n)
4848
n = n - self.total_cycles[cycle]
4949
if (self.verbosity_interval > 0) and (n % self.verbosity_interval == 0):
50-
logger.info(f"current step: {n}, last lr-multiplier: {self.last_f}, " f"current cycle {cycle}")
50+
logger.info(f"current step: {n}, last lr-multiplier: {self.last_f}, current cycle {cycle}")
5151

5252
f_min = self.f_min[cycle]
5353
f_max = self.f_max[cycle]
@@ -74,7 +74,7 @@ def schedule(self, n, **kwargs):
7474
cycle = self.find_in_interval(n)
7575
n = n - self.total_cycles[cycle]
7676
if (self.verbosity_interval > 0) and (n % self.verbosity_interval == 0):
77-
logger.info(f"current step: {n}, last lr-multiplier: {self.last_f}, " f"current cycle {cycle}")
77+
logger.info(f"current step: {n}, last lr-multiplier: {self.last_f}, current cycle {cycle}")
7878

7979
f_min = self.f_min[cycle]
8080
f_max = self.f_max[cycle]

src/neurosis/utils/sgm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def mean_flat(tensor: Tensor) -> Tensor:
134134
def count_params(model: Module, verbose: bool = False) -> int:
135135
total_params = sum(p.numel() for p in model.parameters())
136136
if verbose:
137-
logger.info(f"{model.__class__.__name__} has {total_params * 1.e-6:.2f} M params.")
137+
logger.info(f"{model.__class__.__name__} has {total_params * 1.0e-6:.2f} M params.")
138138
return total_params
139139

140140

0 commit comments

Comments
 (0)