Models
models
Source separation models.
Modules:
Name | Description |
---|---|
bs_roformer |
Band-Split RoPE Transformer |
utils |
|
Classes:
Name | Description |
---|---|
ModelParamsLike |
A trait that must be implemented to be considered a model parameter. |
ModelMetadata |
Metadata about a model, including its type, parameter class, and model class. |
Attributes:
Name | Type | Description |
---|---|---|
ModelT |
|
|
ModelParamsLikeT |
|
ModelParamsLike
Bases: Protocol
A trait that must be implemented to be considered a model parameter.
Note that input_type
and output_type
belong to a model's definition
and does not allow modification via the configuration dictionary.
Attributes:
Name | Type | Description |
---|---|---|
chunk_size |
ChunkSize
|
|
output_stem_names |
tuple[ModelOutputStemName, ...]
|
|
input_type |
ModelInputType
|
|
output_type |
ModelOutputType
|
|
ModelParamsLikeT
module-attribute
ModelParamsLikeT = TypeVar(
"ModelParamsLikeT", bound=ModelParamsLike
)
ModelMetadata
dataclass
ModelMetadata(
model_type: ModelType,
params: type[ModelParamsLikeT],
model: type[ModelT],
)
Bases: Generic[ModelT, ModelParamsLikeT]
Metadata about a model, including its type, parameter class, and model class.
Methods:
Name | Description |
---|---|
from_module |
Dynamically import a model named |
Attributes:
Name | Type | Description |
---|---|---|
model_type |
ModelType
|
|
params |
type[ModelParamsLikeT]
|
|
model |
type[ModelT]
|
|
from_module
classmethod
from_module(
module_name: str,
model_cls_name: str,
*,
model_type: ModelType,
package: str | None = None,
) -> ModelMetadata[Module, ModelParamsLike]
Dynamically import a model named X
and its parameter dataclass XParams
under a
given module name (e.g. splifft.models.bs_roformer
).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_cls_name
|
str
|
The name of the model class to import, e.g. |
required |
module_name
|
str
|
The name of the module to import, e.g. |
required |
model_type
|
ModelType
|
The type of the model, e.g. |
required |
package
|
str | None
|
The package to use as the anchor point from which to resolve the relative import. to an absolute import. This is only required when performing a relative import. |
None
|
Source code in src/splifft/models/__init__.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
|
bs_roformer
Band-Split RoPE Transformer
- BS-RoFormer: https://arxiv.org/abs/2309.02612
- Mel-RoFormer: https://arxiv.org/abs/2409.04702
This implementation merges the two versions found in
lucidrains
's implementation
However, there are several inconsistencies:
MLP
was defined differently in each file, one that hasdepth - 1
hidden layers and one that hasdepth
layers.BSRoformer
applies one final RMSNorm after the entire stack of transformer layers, while theMelBandRoformer
applies an RMSNorm at the end of each axial transformer block (time_transformer, freq_transformer, etc.) and has no final normalization layer.
Since fixing the three inconsistencies upstream is too big of a breaking change, we inherit them to maintain compatability with community-trained models. See: https://github.com/lucidrains/BS-RoFormer/issues/48.
To avoid dependency bloat, we do not:
- depend on
rotary_embeddings_torch
- implement
hyper_connections
- implement learned value residual learning
Classes:
Name | Description |
---|---|
FixedBandsConfig |
|
MelBandsConfig |
|
BSRoformerParams |
|
RMSNorm |
|
RMSNormWithEps |
|
RotaryEmbedding |
A performance-oriented version of RoPE. |
FeedForward |
|
Attention |
|
LinearAttention |
this flavor of linear attention proposed in https://arxiv.org/abs/2106.09681 by El-Nouby et al. |
Transformer |
|
BandSplit |
|
MaskEstimator |
|
BSRoformer |
|
Functions:
Name | Description |
---|---|
l2norm |
|
rms_norm |
|
mlp |
|
Attributes:
Name | Type | Description |
---|---|---|
DEFAULT_FREQS_PER_BANDS |
|
DEFAULT_FREQS_PER_BANDS
module-attribute
DEFAULT_FREQS_PER_BANDS = (
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
4,
12,
12,
12,
12,
12,
12,
12,
12,
24,
24,
24,
24,
24,
24,
24,
24,
48,
48,
48,
48,
48,
48,
48,
48,
128,
129,
)
FixedBandsConfig
dataclass
FixedBandsConfig(
kind: Literal["fixed"] = "fixed",
freqs_per_bands: tuple[Gt0[int], ...] = (
lambda: DEFAULT_FREQS_PER_BANDS
)(),
)
MelBandsConfig
dataclass
MelBandsConfig(
kind: Literal["mel"],
num_bands: Gt0[int],
sample_rate: Gt0[int],
stft_n_fft: Gt0[int],
)
BSRoformerParams
dataclass
BSRoformerParams(
chunk_size: ChunkSize,
output_stem_names: tuple[ModelOutputStemName, ...],
dim: Gt0[int],
depth: Gt0[int],
stft_hop_length: HopSize,
stereo: bool = True,
time_transformer_depth: Gt0[int] = 1,
freq_transformer_depth: Gt0[int] = 1,
linear_transformer_depth: Ge0[int] = 0,
band_config: FixedBandsConfig
| MelBandsConfig = FixedBandsConfig(),
dim_head: int = 64,
heads: Gt0[int] = 8,
attn_dropout: Dropout = 0.0,
ff_dropout: Dropout = 0.0,
ff_mult: Gt0[int] = 4,
flash_attn: bool = True,
norm_output: bool = False,
mask_estimator_depth: Gt0[int] = 2,
mlp_expansion_factor: Gt0[int] = 4,
use_torch_checkpoint: bool = False,
sage_attention: bool = False,
use_shared_bias: bool = False,
skip_connection: bool = False,
rms_norm_eps: Ge0[float] | None = None,
rotary_embed_dtype: TorchDtype | None = None,
transformer_residual_dtype: TorchDtype | None = None,
debug: bool = False,
)
Bases: ModelParamsLike
Attributes:
Name | Type | Description |
---|---|---|
chunk_size |
ChunkSize
|
|
output_stem_names |
tuple[ModelOutputStemName, ...]
|
|
dim |
Gt0[int]
|
|
depth |
Gt0[int]
|
|
stft_hop_length |
HopSize
|
|
stereo |
bool
|
|
time_transformer_depth |
Gt0[int]
|
|
freq_transformer_depth |
Gt0[int]
|
|
linear_transformer_depth |
Ge0[int]
|
|
band_config |
FixedBandsConfig | MelBandsConfig
|
|
dim_head |
int
|
|
heads |
Gt0[int]
|
|
attn_dropout |
Dropout
|
|
ff_dropout |
Dropout
|
|
ff_mult |
Gt0[int]
|
|
flash_attn |
bool
|
|
norm_output |
bool
|
Note that in |
mask_estimator_depth |
Gt0[int]
|
The number of hidden layers of the MLP is |
mlp_expansion_factor |
Gt0[int]
|
|
use_torch_checkpoint |
bool
|
|
sage_attention |
bool
|
|
use_shared_bias |
bool
|
|
skip_connection |
bool
|
|
rms_norm_eps |
Ge0[float] | None
|
|
rotary_embed_dtype |
TorchDtype | None
|
|
transformer_residual_dtype |
TorchDtype | None
|
|
debug |
bool
|
Whether to check for nan/inf in model outputs. Keep it off for torch.compile. |
input_type |
ModelInputType
|
|
output_type |
ModelOutputType
|
|
band_config
class-attribute
instance-attribute
band_config: FixedBandsConfig | MelBandsConfig = field(
default_factory=FixedBandsConfig
)
norm_output
class-attribute
instance-attribute
norm_output: bool = False
Note that in lucidrains
' implementation, this is set to
False for bs_roformer
but True for mel_roformer
!!
mask_estimator_depth
class-attribute
instance-attribute
The number of hidden layers of the MLP is mask_estimator_depth - 1
, that is:
- depth = 1: (dim_in, dim_out)
- depth = 2: (dim_in, dim_hidden, dim_out)
Note that in lucidrains
' implementation of mel-band roformers, the number of hidden layers
is incorrectly set as mask_estimator_depth
. This includes popular models like kim-vocals and
all models that use zfturbo
's music-source-separation training.
If you are migrating a mel-band roformer's zfturbo
configuration, increment the mask_estimator
depth by 1.
transformer_residual_dtype
class-attribute
instance-attribute
transformer_residual_dtype: TorchDtype | None = None
debug
class-attribute
instance-attribute
debug: bool = False
Whether to check for nan/inf in model outputs. Keep it off for torch.compile.
l2norm
Source code in src/splifft/models/bs_roformer.py
127 128 |
|
RMSNorm
RMSNorm(dim: int)
Bases: Module
Methods:
Name | Description |
---|---|
forward |
|
Attributes:
Name | Type | Description |
---|---|---|
scale |
|
|
gamma |
|
Source code in src/splifft/models/bs_roformer.py
132 133 134 135 |
|
scale
instance-attribute
scale = dim ** 0.5
RMSNormWithEps
Bases: Module
Methods:
Name | Description |
---|---|
forward |
|
Attributes:
Name | Type | Description |
---|---|---|
scale |
|
|
gamma |
|
|
eps |
|
Source code in src/splifft/models/bs_roformer.py
142 143 144 145 146 |
|
scale
instance-attribute
scale = dim ** 0.5
eps
instance-attribute
eps = eps
forward
Source code in src/splifft/models/bs_roformer.py
148 149 150 151 152 |
|
rms_norm
rms_norm(
dim: int, eps: float | None
) -> RMSNorm | RMSNormWithEps
Source code in src/splifft/models/bs_roformer.py
155 156 157 158 |
|
RotaryEmbedding
Bases: Module
A performance-oriented version of RoPE.
Unlike lucidrains
' implementation which compute embeddings JIT during the
forward pass and caches calls with the same or shorter sequence length,
we simply compute them AOT as persistent buffers. To keep the computational
graph clean, we do not support dynamic sequence lengths, learned frequencies
or length extrapolation.
Methods:
Name | Description |
---|---|
rotate_half |
|
forward |
|
Attributes:
Name | Type | Description |
---|---|---|
cos_emb |
|
|
sin_emb |
|
Source code in src/splifft/models/bs_roformer.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
|
cos_emb
instance-attribute
cos_emb = to(dtype)
sin_emb
instance-attribute
sin_emb = to(dtype)
rotate_half
Source code in src/splifft/models/bs_roformer.py
196 197 198 199 200 |
|
forward
Source code in src/splifft/models/bs_roformer.py
202 203 204 205 206 207 208 209 210 211 212 |
|
FeedForward
Bases: Module
Methods:
Name | Description |
---|---|
forward |
|
Attributes:
Name | Type | Description |
---|---|---|
net |
|
Source code in src/splifft/models/bs_roformer.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
|
Attention
Attention(
dim: int,
heads: int = 8,
dim_head: int = 64,
dropout: float = 0.0,
shared_qkv_bias: Parameter | None = None,
shared_out_bias: Parameter | None = None,
rotary_embed: RotaryEmbedding | None = None,
flash: bool = True,
sage_attention: bool = False,
rms_norm_eps: float | None = None,
)
Bases: Module
Methods:
Name | Description |
---|---|
forward |
|
Attributes:
Name | Type | Description |
---|---|---|
heads |
|
|
scale |
|
|
rotary_embed |
|
|
attend |
|
|
norm |
|
|
to_qkv |
|
|
to_gates |
|
|
to_out |
|
Source code in src/splifft/models/bs_roformer.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
|
heads
instance-attribute
heads = heads
scale
instance-attribute
scale = dim_head ** -0.5
rotary_embed
instance-attribute
rotary_embed = rotary_embed
to_out
instance-attribute
to_out = Sequential(
Linear(
dim_inner, dim, bias=shared_out_bias is not None
),
Dropout(dropout),
)
forward
Source code in src/splifft/models/bs_roformer.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
|
LinearAttention
LinearAttention(
*,
dim: int,
dim_head: int = 32,
heads: int = 8,
scale: int = 8,
flash: bool = False,
dropout: float = 0.0,
sage_attention: bool = False,
rms_norm_eps: float | None = None,
)
Bases: Module
this flavor of linear attention proposed in https://arxiv.org/abs/2106.09681 by El-Nouby et al.
Methods:
Name | Description |
---|---|
forward |
|
Attributes:
Name | Type | Description |
---|---|---|
norm |
|
|
to_qkv |
|
|
temperature |
|
|
attend |
|
|
to_out |
|
Source code in src/splifft/models/bs_roformer.py
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
|
to_qkv
instance-attribute
to_qkv = Sequential(
Linear(dim, dim_inner * 3, bias=False),
Rearrange(
"b n (qkv h d) -> qkv b h d n", qkv=3, h=heads
),
)
to_out
instance-attribute
to_out = Sequential(
Rearrange("b h d n -> b n (h d)"),
Linear(dim_inner, dim, bias=False),
)
forward
Source code in src/splifft/models/bs_roformer.py
342 343 344 345 346 347 348 349 350 351 352 |
|
Transformer
Transformer(
*,
dim: int,
depth: int,
dim_head: int = 64,
heads: int = 8,
attn_dropout: float = 0.0,
ff_dropout: float = 0.0,
ff_mult: int = 4,
norm_output: bool = True,
rotary_embed: RotaryEmbedding | None = None,
flash_attn: bool = True,
linear_attn: bool = False,
sage_attention: bool = False,
shared_qkv_bias: Parameter | None = None,
shared_out_bias: Parameter | None = None,
rms_norm_eps: float | None = None,
transformer_residual_dtype: dtype | None = None,
)
Bases: Module
Methods:
Name | Description |
---|---|
forward |
|
Attributes:
Name | Type | Description |
---|---|---|
layers |
|
|
transformer_residual_dtype |
|
|
norm |
|
Source code in src/splifft/models/bs_roformer.py
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 |
|
transformer_residual_dtype
instance-attribute
transformer_residual_dtype = transformer_residual_dtype
forward
Source code in src/splifft/models/bs_roformer.py
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 |
|
BandSplit
Bases: Module
Methods:
Name | Description |
---|---|
forward |
|
Attributes:
Name | Type | Description |
---|---|---|
dim_inputs |
|
|
to_features |
|
Source code in src/splifft/models/bs_roformer.py
437 438 439 440 441 442 443 444 |
|
dim_inputs
instance-attribute
dim_inputs = dim_inputs
forward
Source code in src/splifft/models/bs_roformer.py
446 447 448 449 450 451 452 |
|
mlp
mlp(
dim_in: int,
dim_out: int,
dim_hidden: int | None = None,
depth: int = 1,
activation: type[Module] = Tanh,
) -> Sequential
Source code in src/splifft/models/bs_roformer.py
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 |
|
MaskEstimator
Bases: Module
Methods:
Name | Description |
---|---|
forward |
|
Attributes:
Name | Type | Description |
---|---|---|
dim_inputs |
|
|
to_freqs |
|
Source code in src/splifft/models/bs_roformer.py
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 |
|
dim_inputs
instance-attribute
dim_inputs = dim_inputs
forward
Source code in src/splifft/models/bs_roformer.py
503 504 505 506 507 508 509 510 511 512 |
|
BSRoformer
BSRoformer(cfg: BSRoformerParams)
Bases: Module
Methods:
Name | Description |
---|---|
forward |
:param stft_repr: input spectrogram. shape (b, f*s, t, c) |
Attributes:
Name | Type | Description |
---|---|---|
stereo |
|
|
audio_channels |
|
|
num_stems |
|
|
use_torch_checkpoint |
|
|
skip_connection |
|
|
layers |
|
|
shared_qkv_bias |
Parameter | None
|
|
shared_out_bias |
Parameter | None
|
|
is_mel |
|
|
final_norm |
|
|
band_split |
|
|
mask_estimators |
|
|
debug |
|
Source code in src/splifft/models/bs_roformer.py
516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 |
|
stereo
instance-attribute
stereo = stereo
audio_channels
instance-attribute
audio_channels = 2 if stereo else 1
use_torch_checkpoint
instance-attribute
use_torch_checkpoint = use_torch_checkpoint
skip_connection
instance-attribute
skip_connection = skip_connection
shared_qkv_bias
instance-attribute
shared_qkv_bias: Parameter | None = None
shared_out_bias
instance-attribute
shared_out_bias: Parameter | None = None
is_mel
instance-attribute
is_mel = is_mel
final_norm
instance-attribute
band_split
instance-attribute
band_split = BandSplit(
dim=dim,
dim_inputs=freqs_per_bands_with_complex,
rms_norm_eps=rms_norm_eps,
)
debug
instance-attribute
debug = debug
forward
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stft_repr
|
Tensor
|
input spectrogram. shape (b, f*s, t, c) |
required |
Returns:
Type | Description |
---|---|
Tensor
|
estimated mask. shape (b, n, f*s, t, c) |
Source code in src/splifft/models/bs_roformer.py
647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 |
|
utils
Modules:
Name | Description |
---|---|
attend |
|
attend_sage |
|
stft |
|
Functions:
Name | Description |
---|---|
parse_version |
|
log_once |
|
parse_version
Source code in src/splifft/models/utils/__init__.py
6 7 8 |
|
log_once
cached
Source code in src/splifft/models/utils/__init__.py
11 12 13 |
|
attend_sage
Classes:
Name | Description |
---|---|
AttendSage |
|
Attributes:
Name | Type | Description |
---|---|---|
logger |
|
AttendSage
Bases: Module
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flash
|
bool
|
if True, attempts to use SageAttention or PyTorch SDPA. |
False
|
Methods:
Name | Description |
---|---|
forward |
einstein notation |
Attributes:
Name | Type | Description |
---|---|---|
scale |
|
|
dropout |
|
|
use_sage |
|
|
use_pytorch_sdpa |
|
|
attn_dropout |
|
Source code in src/splifft/models/utils/attend_sage.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
scale
instance-attribute
scale = scale
dropout
instance-attribute
dropout = dropout
use_sage
instance-attribute
use_sage = flash and _has_sage_attention
use_pytorch_sdpa
instance-attribute
use_pytorch_sdpa = False
forward
einstein notation
- b: batch
- h: heads
- n, i, j: sequence length (base sequence length, source, target)
- d: feature dimension
Input tensors q, k, v expected in shape: (batch, heads, seq_len, dim_head) -> HND layout
Source code in src/splifft/models/utils/attend_sage.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
|
attend
Classes:
Name | Description |
---|---|
Attend |
|
Attributes:
Name | Type | Description |
---|---|---|
logger |
|
Attend
Bases: Module
Methods:
Name | Description |
---|---|
flash_attn |
|
forward |
einstein notation |
Attributes:
Name | Type | Description |
---|---|---|
scale |
|
|
dropout |
|
|
attn_dropout |
|
|
flash |
|
|
cpu_backends |
|
|
cuda_backends |
list[_SDPBackend] | None
|
|
Source code in src/splifft/models/utils/attend.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
|
scale
instance-attribute
scale = scale
dropout
instance-attribute
dropout = dropout
flash
instance-attribute
flash = flash
cpu_backends
instance-attribute
cpu_backends = [FLASH_ATTENTION, EFFICIENT_ATTENTION, MATH]
flash_attn
Source code in src/splifft/models/utils/attend.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
|
forward
einstein notation
- b: batch
- h: heads
- n, i, j: sequence length (base sequence length, source, target)
- d: feature dimension
Source code in src/splifft/models/utils/attend.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
stft
Classes:
Name | Description |
---|---|
Stft |
A custom STFT implementation using 1D convolutions to ensure compatibility with CoreML. |
IStft |
A simple wrapper around torch.istft with a hacky workaround for MPS. |
Stft
Stft(
n_fft: int,
hop_length: int,
win_length: int,
window_fn: Callable[[int], Tensor],
conv_dtype: dtype | None,
)
Bases: Module
A custom STFT implementation using 1D convolutions to ensure compatibility with CoreML.
Methods:
Name | Description |
---|---|
forward |
|
Attributes:
Name | Type | Description |
---|---|---|
n_fft |
|
|
hop_length |
|
|
win_length |
|
|
conv_dtype |
|
Source code in src/splifft/models/utils/stft.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
n_fft
instance-attribute
n_fft = n_fft
hop_length
instance-attribute
hop_length = hop_length
win_length
instance-attribute
win_length = win_length
conv_dtype
instance-attribute
conv_dtype = conv_dtype
forward
forward(x: Tensor) -> ComplexSpectrogram
Source code in src/splifft/models/utils/stft.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
IStft
IStft(
n_fft: int,
hop_length: int,
win_length: int,
window_fn: Callable[[int], Tensor] = hann_window,
)
Bases: Module
A simple wrapper around torch.istft with a hacky workaround for MPS.
TODO: implement a proper workaround.
Methods:
Name | Description |
---|---|
forward |
|
Attributes:
Name | Type | Description |
---|---|---|
n_fft |
|
|
hop_length |
|
|
win_length |
|
|
window |
|
Source code in src/splifft/models/utils/stft.py
69 70 71 72 73 74 75 76 77 78 79 80 |
|
n_fft
instance-attribute
n_fft = n_fft
hop_length
instance-attribute
hop_length = hop_length
win_length
instance-attribute
win_length = win_length
window
instance-attribute
window = window_fn(win_length)
forward
forward(
spec: ComplexSpectrogram, length: int | None = None
) -> RawAudioTensor | NormalizedAudioTensor
Source code in src/splifft/models/utils/stft.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
|