Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 4 additions & 3 deletions scnet/SCNet.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import torch.nn.functional as F
from collections import deque
from .separation import SeparationNet
import typing as tp
from typing import cast
import math

class Swish(nn.Module):
Expand Down Expand Up @@ -147,7 +147,7 @@ def __init__(self, channels_in, channels_out, band_configs):

# Initializing convolutional layers for each band
self.convtrs = nn.ModuleList([
nn.ConvTranspose2d(channels_in, channels_out, [config['kernel'], 1], [config['stride'], 1])
nn.ConvTranspose2d(channels_in, channels_out, (config['kernel'], 1), (config['stride'], 1))
for _, config in band_configs.items()
])

Expand Down Expand Up @@ -351,7 +351,8 @@ def forward(self, x):
x = self.separation_net(x)

#decoder
for fusion_layer, su_layer in self.decoder:
for dec in self.decoder:
fusion_layer, su_layer = cast(nn.Sequential, dec)
x = fusion_layer(x, save_skip.pop())
x = su_layer(x, save_lengths.pop(), save_original_lengths.pop())

Expand Down
4 changes: 2 additions & 2 deletions scnet/apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def apply_model(model, mix, shifts=1, split=True, segment=20, samplerate=44100,
segment = int(samplerate * segment)
stride = int((1 - overlap) * segment)
offsets = range(0, length, stride)
scale = stride / samplerate
scale = stride // samplerate
weight = th.cat([th.arange(1, segment // 2 + 1, device=device),
th.arange(segment - segment // 2, 0, -1, device=device)])
assert len(weight) == segment
Expand All @@ -122,7 +122,7 @@ def apply_model(model, mix, shifts=1, split=True, segment=20, samplerate=44100,
futures.append((future, offset))
offset += segment
if progress:
futures = tqdm.tqdm(futures, unit_scale=scale, ncols=120, unit='seconds')
futures = tqdm.tqdm(futures, total=scale, ncols=120, unit='chunks')
for future, offset in futures:
chunk_out = future.result()
chunk_length = chunk_out.shape[-1]
Expand Down