Skip to content

Commit 0e65bed

Browse files
committed
apply lint
1 parent daa50a9 commit 0e65bed

11 files changed

Lines changed: 55 additions & 14 deletions

File tree

.githooks/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
# Entire CLI hooks
3+
# Commit-msg hook: strip trailer if no user content (allows aborting empty commits)
4+
if command -v entire >/dev/null 2>&1; then entire hooks git commit-msg "$1" || true; else printf '%s\n' '[entire] Entire CLI is enabled but not installed or not on PATH. Skipping Entire Git hook; continuing. Installation guide: https://docs.entire.io/cli/installation#installation-methods' >&2 || :; fi

.githooks/post-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
# Entire CLI hooks
3+
# Post-commit hook: condense session data if commit has Entire-Checkpoint trailer
4+
if command -v entire >/dev/null 2>&1; then entire hooks git post-commit 2>/dev/null || true; else :; fi

.githooks/post-rewrite

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
# Entire CLI hooks
3+
# Post-rewrite hook: remap session linkage after amend/rebase rewrites
4+
if command -v entire >/dev/null 2>&1; then entire hooks git post-rewrite "$1" 2>/dev/null || true; else :; fi

.githooks/pre-push

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
# Entire CLI hooks
3+
# Pre-push hook: push session logs alongside user's push
4+
# $1 is the remote name (e.g., "origin")
5+
if command -v entire >/dev/null 2>&1; then entire hooks git pre-push "$1"; else :; fi

.githooks/prepare-commit-msg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
# Entire CLI hooks
3+
if command -v entire >/dev/null 2>&1; then entire hooks git prepare-commit-msg "$1" "$2" 2>/dev/null || true; else :; fi

src/ald_sc/audio_codec.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ def _load_model(self) -> None:
144144
logger.warning("Failed to load EnCodec model: %s", e)
145145
raise
146146

147-
def encode(self, x: Tensor, prior: ArrowSpacePrior) -> tuple[Tensor, Tensor, Tensor]:
147+
def encode(
148+
self, x: Tensor, prior: ArrowSpacePrior
149+
) -> tuple[Tensor, Tensor, Tensor]:
148150
"""Encode audio waveform to (z, A, c_spec).
149151
150152
Parameters
@@ -271,7 +273,9 @@ def __init__(
271273
)
272274
)
273275

274-
self.dec_out = nn.Conv1d(channel_steps[len(upsample_strides)], out_channels, 3, padding=1)
276+
self.dec_out = nn.Conv1d(
277+
channel_steps[len(upsample_strides)], out_channels, 3, padding=1
278+
)
275279

276280
def forward(self, z: Tensor) -> Tensor:
277281
"""Decode 1-D latent to waveform (no spectral conditioning).

src/ald_sc/graph_decoder.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,9 @@ def __init__(
190190
)
191191
)
192192

193-
self.dec_out = nn.Conv1d(channel_steps[len(upsample_strides)], out_channels, 3, padding=1)
193+
self.dec_out = nn.Conv1d(
194+
channel_steps[len(upsample_strides)], out_channels, 3, padding=1
195+
)
194196

195197
def forward(self, z: Tensor, c_spec: Tensor) -> Tensor:
196198
"""Decode 1-D latent under graph-structured reconstruction.
@@ -291,7 +293,9 @@ def __init__(
291293
)
292294
)
293295

294-
self.dec_out = nn.Conv1d(channel_steps[len(upsample_strides)], out_channels, 3, padding=1)
296+
self.dec_out = nn.Conv1d(
297+
channel_steps[len(upsample_strides)], out_channels, 3, padding=1
298+
)
295299

296300
def forward(
297301
self,

src/ald_sc/losses.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,17 @@ def stft_loss(self, x: Tensor, x_hat: Tensor) -> Tensor:
9595
hop = n_fft // 4
9696
window = self._windows[n_fft].to(device=x.device, dtype=x.dtype)
9797
spec_x = torch.stft(
98-
x, n_fft, hop_length=hop, return_complex=True,
98+
x,
99+
n_fft,
100+
hop_length=hop,
101+
return_complex=True,
99102
window=window,
100103
)
101104
spec_xhat = torch.stft(
102-
x_hat, n_fft, hop_length=hop, return_complex=True,
105+
x_hat,
106+
n_fft,
107+
hop_length=hop,
108+
return_complex=True,
103109
window=window,
104110
)
105111

src/ald_sc/sampling.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,12 @@ def _init_noise(
5151
)
5252
latent_size = getattr(model, "latent_size", 32)
5353
return torch.randn(
54-
batch_size, latent_channels, latent_size, latent_size,
55-
device=device, generator=gen,
54+
batch_size,
55+
latent_channels,
56+
latent_size,
57+
latent_size,
58+
device=device,
59+
generator=gen,
5660
)
5761

5862

tests/test_audio_codec.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ def __init__(self, latent_dim: int = 128) -> None:
3838
self.latent_dim = latent_dim
3939
self.proj = nn.Conv1d(1, latent_dim, 320, stride=320)
4040

41-
def encode(self, x: Tensor, prior: ArrowSpacePrior) -> tuple[Tensor, Tensor, Tensor]:
41+
def encode(
42+
self, x: Tensor, prior: ArrowSpacePrior
43+
) -> tuple[Tensor, Tensor, Tensor]:
4244
z = self.proj(x).float()
4345
a = z.mean(dim=2)
4446
c_spec = prior.chart_energy_descriptor(a)
@@ -133,9 +135,7 @@ class TestExtractFeatures:
133135
def test_extract_features_shape(self) -> None:
134136
"""Extract features from a stub encoder."""
135137
encoder = StubEncoder(latent_dim=128)
136-
loader = torch.utils.data.DataLoader(
137-
torch.randn(8, 1, 320 * 4), batch_size=4
138-
)
138+
loader = torch.utils.data.DataLoader(torch.randn(8, 1, 320 * 4), batch_size=4)
139139
features = extract_encodec_features(loader, encoder) # type: ignore
140140
assert features.shape == (8, 128)
141141

0 commit comments

Comments
 (0)