Models
models
Source separation models.
Modules:
| Name | Description |
|---|---|
basic_pitch |
ICASSP 2022 Basic Pitch. Raw multi-stream outputs only, no symbolic decoding. |
beat_this |
Beat This! Beat Tracker. |
bs_roformer |
Band-Split RoPE Transformer |
mdx23c |
MDX23C. |
pesto |
PESTO: Pitch Estimation with Self-supervised Transposition-equivariant Objective. |
utils |
|
Classes:
| Name | Description |
|---|---|
ModelParamsLike |
A trait that must be implemented to be considered a model parameter. |
StemSelectionPlan |
Optional model-specific plan for selective stem inference. |
SupportsStemSelection |
|
ModelMetadata |
Metadata about a model, including its type, parameter class, and model class. |
Attributes:
| Name | Type | Description |
|---|---|---|
ModelT |
|
|
ModelParamsLikeT |
|
|
StateDictTransform |
TypeAlias
|
|
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:
ModelParamsLikeT
module-attribute
ModelParamsLikeT = TypeVar(
"ModelParamsLikeT", bound=ModelParamsLike
)
StateDictTransform
module-attribute
StemSelectionPlan
dataclass
StemSelectionPlan(
model_params: ModelParamsLikeT,
output_stem_names: tuple[ModelOutputStemName, ...],
state_dict_transform: StateDictTransform | None = None,
)
Bases: Generic[ModelParamsLikeT]
Optional model-specific plan for selective stem inference.
Models can provide this plan to: - instantiate a stem-reduced parameter set, and/or - return a checkpoint state-dict transformer that drops/remaps unrelated heads.
output_stem_names defines the output ordering produced by the instantiated
model after applying the plan.
Attributes:
| Name | Type | Description |
|---|---|---|
model_params |
ModelParamsLikeT
|
|
output_stem_names |
tuple[ModelOutputStemName, ...]
|
|
state_dict_transform |
StateDictTransform | None
|
|
state_dict_transform
class-attribute
instance-attribute
state_dict_transform: StateDictTransform | None = None
SupportsStemSelection
Bases: Protocol[ModelParamsLikeT]
Methods:
| Name | Description |
|---|---|
__splifft_stem_selection_plan__ |
|
__splifft_stem_selection_plan__
classmethod
__splifft_stem_selection_plan__(
model_params: ModelParamsLikeT,
output_stem_names: tuple[ModelOutputStemName, ...],
) -> StemSelectionPlan[ModelParamsLikeT]
Source code in src/splifft/models/__init__.py
59 60 61 62 63 64 | |
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
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 | |
pesto
PESTO: Pitch Estimation with Self-supervised Transposition-equivariant Objective.
See: https://github.com/SonyCSLParis/pesto, https://arxiv.org/abs/2309.02265
Classes:
| Name | Description |
|---|---|
PestoParams |
|
ToeplitzLinear |
|
Resnet1d |
Compact 1D CNN used by PESTO to decode HCQT frames into activations. |
ConfidenceClassifier |
Frame-level voiced/unvoiced confidence head. |
Pesto |
PESTO inference head over externally computed HCQT features. |
Functions:
| Name | Description |
|---|---|
reduce_activations |
Reduce per-bin probabilities to scalar pitch per frame. |
PestoParams
dataclass
PestoParams(
chunk_size: ChunkSize,
output_stem_names: tuple[ModelOutputStemName, ...],
reduction: Literal["argmax", "mean", "alwa"] = "alwa",
convert_to_freq: bool = True,
crop_freq_bins_bottom: Ge0[int] = 16,
crop_freq_bins_top: Ge0[int] = 16,
n_chan_input: Gt0[int] = 1,
n_chan_layers: tuple[Gt0[int], ...] = (
40,
30,
30,
10,
3,
),
n_prefilt_layers: Gt0[int] = 3,
prefilt_kernel_size: Gt0[int] = 39,
residual: bool = True,
n_bins_in: Gt0[int] = 219,
output_dim: Gt0[int] = 384,
activation_fn: Literal[
"relu", "silu", "leaky"
] = "leaky",
a_lrelu: Ge0[float] = 0.3,
p_dropout: Dropout = 0.2,
bins_per_semitone: Gt0[int] = 3,
)
Bases: ModelParamsLike
Attributes:
| Name | Type | Description |
|---|---|---|
chunk_size |
ChunkSize
|
|
output_stem_names |
tuple[ModelOutputStemName, ...]
|
|
reduction |
Literal['argmax', 'mean', 'alwa']
|
|
convert_to_freq |
bool
|
|
crop_freq_bins_bottom |
Ge0[int]
|
|
crop_freq_bins_top |
Ge0[int]
|
|
n_chan_input |
Gt0[int]
|
|
n_chan_layers |
tuple[Gt0[int], ...]
|
|
n_prefilt_layers |
Gt0[int]
|
|
prefilt_kernel_size |
Gt0[int]
|
|
residual |
bool
|
|
n_bins_in |
Gt0[int]
|
|
output_dim |
Gt0[int]
|
|
activation_fn |
Literal['relu', 'silu', 'leaky']
|
|
a_lrelu |
Ge0[float]
|
|
p_dropout |
Dropout
|
|
bins_per_semitone |
Gt0[int]
|
|
input_channels |
ModelInputChannels
|
|
input_type |
ModelInputType
|
|
output_type |
ModelOutputType
|
|
inference_archetype |
InferenceArchetype
|
|
n_chan_layers
class-attribute
instance-attribute
activation_fn
class-attribute
instance-attribute
activation_fn: Literal['relu', 'silu', 'leaky'] = 'leaky'
ToeplitzLinear
Bases: Conv1d
Methods:
| Name | Description |
|---|---|
forward |
|
Source code in src/splifft/models/pesto.py
65 66 67 68 69 70 71 72 | |
Resnet1d
Resnet1d(
*,
n_chan_input: int = 1,
n_chan_layers: tuple[int, ...] = (40, 30, 30, 10, 3),
n_prefilt_layers: int = 3,
prefilt_kernel_size: int = 39,
residual: bool = True,
n_bins_in: int = 219,
output_dim: int = 384,
activation_fn: Literal[
"relu", "silu", "leaky"
] = "leaky",
a_lrelu: float = 0.3,
p_dropout: float = 0.2,
)
Bases: Module
Compact 1D CNN used by PESTO to decode HCQT frames into activations.
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
layernorm |
|
|
conv1 |
|
|
n_prefilt_layers |
|
|
prefilt_layers |
|
|
residual |
|
|
conv_layers |
|
|
flatten |
|
|
fc |
|
|
final_norm |
|
Source code in src/splifft/models/pesto.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 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 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |
conv1
instance-attribute
conv1 = Sequential(
Conv1d(
in_channels=n_chan_input,
out_channels=n_ch[0],
kernel_size=prefilt_kernel_size,
padding=prefilt_padding,
stride=1,
),
activation_layer(),
Dropout(p=p_dropout),
)
n_prefilt_layers
instance-attribute
n_prefilt_layers = n_prefilt_layers
prefilt_layers
instance-attribute
prefilt_layers = ModuleList(
[
(
Sequential(
Conv1d(
in_channels=n_ch[0],
out_channels=n_ch[0],
kernel_size=prefilt_kernel_size,
padding=prefilt_padding,
stride=1,
),
activation_layer(),
Dropout(p=p_dropout),
)
)
for _ in (range(n_prefilt_layers - 1))
]
)
residual
instance-attribute
residual = residual
flatten
instance-attribute
flatten = Flatten(start_dim=1)
forward
Source code in src/splifft/models/pesto.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | |
ConfidenceClassifier
ConfidenceClassifier()
Bases: Module
Frame-level voiced/unvoiced confidence head.
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
conv |
|
|
linear |
|
Source code in src/splifft/models/pesto.py
185 186 187 188 | |
forward
Source code in src/splifft/models/pesto.py
190 191 192 193 194 195 196 | |
reduce_activations
Reduce per-bin probabilities to scalar pitch per frame.
Source code in src/splifft/models/pesto.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | |
Pesto
Pesto(cfg: PestoParams)
Bases: Module
PESTO inference head over externally computed HCQT features.
Input contract: tensor of shape (batch, time, feature_dim) where
feature_dim = harmonics * freq_bins in dB log-magnitude HCQT.
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
cfg |
|
|
encoder |
|
|
confidence |
|
Source code in src/splifft/models/pesto.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | |
cfg
instance-attribute
cfg = cfg
encoder
instance-attribute
encoder = Resnet1d(
n_chan_input=n_chan_input,
n_chan_layers=n_chan_layers,
n_prefilt_layers=n_prefilt_layers,
prefilt_kernel_size=prefilt_kernel_size,
residual=residual,
n_bins_in=n_bins_in,
output_dim=output_dim,
activation_fn=activation_fn,
a_lrelu=a_lrelu,
p_dropout=p_dropout,
)
forward
Source code in src/splifft/models/pesto.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | |
beat_this
Beat This! Beat Tracker.
- See: https://arxiv.org/abs/2407.21658
- Adapted from: https://github.com/CPJKU/beat_this.
- License: MIT
Classes:
| Name | Description |
|---|---|
BeatThisParams |
|
PartialFTTransformer |
Takes a (batch, channels, freqs, time) input, applies self-attention and |
SumHead |
|
Head |
|
BeatThis |
|
BeatThisParams
dataclass
BeatThisParams(
chunk_size: ChunkSize,
output_stem_names: tuple[ModelOutputStemName, ...],
spect_dim: Gt0[int] = 128,
transformer_dim: Gt0[int] = 512,
ff_mult: Gt0[int] = 4,
n_layers: Gt0[int] = 6,
head_dim: Gt0[int] = 32,
stem_dim: Gt0[int] = 32,
dropout_frontend: Dropout = 0.1,
dropout_transformer: Dropout = 0.2,
sum_head: bool = True,
partial_transformers: bool = True,
rotary_embed_dtype: TorchDtype | None = None,
transformer_residual_dtype: TorchDtype | None = None,
log_mel_hop_length: HopSize = 441,
)
Bases: ModelParamsLike
Attributes:
| Name | Type | Description |
|---|---|---|
chunk_size |
ChunkSize
|
|
output_stem_names |
tuple[ModelOutputStemName, ...]
|
|
spect_dim |
Gt0[int]
|
|
transformer_dim |
Gt0[int]
|
|
ff_mult |
Gt0[int]
|
|
n_layers |
Gt0[int]
|
|
head_dim |
Gt0[int]
|
|
stem_dim |
Gt0[int]
|
|
dropout_frontend |
Dropout
|
|
dropout_transformer |
Dropout
|
|
sum_head |
bool
|
|
partial_transformers |
bool
|
|
rotary_embed_dtype |
TorchDtype | None
|
|
transformer_residual_dtype |
TorchDtype | None
|
|
log_mel_hop_length |
HopSize
|
The hop length of the log mel spectrogram. |
input_channels |
ModelInputChannels
|
|
input_type |
ModelInputType
|
|
output_type |
ModelOutputType
|
|
inference_archetype |
InferenceArchetype
|
|
transformer_residual_dtype
class-attribute
instance-attribute
transformer_residual_dtype: TorchDtype | None = None
log_mel_hop_length
class-attribute
instance-attribute
log_mel_hop_length: HopSize = 441
The hop length of the log mel spectrogram.
Warning
This must match the hop_length in the LogMelConfig to ensure the rotary embeddings
are sized correctly for the sequence length.
PartialFTTransformer
PartialFTTransformer(
dim: int,
dim_head: int,
n_head: int,
rotary_embed_f: RotaryEmbedding,
rotary_embed_t: RotaryEmbedding,
dropout: float,
)
Bases: Module
Takes a (batch, channels, freqs, time) input, applies self-attention and a feed-forward block once across frequencies and once across time.
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
attnF |
|
|
ffF |
|
|
attnT |
|
|
ffT |
|
Source code in src/splifft/models/beat_this.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
attnF
instance-attribute
attnF = Attention(
dim,
heads=n_head,
dim_head=dim_head,
dropout=dropout,
rotary_embed=rotary_embed_f,
)
attnT
instance-attribute
attnT = Attention(
dim,
heads=n_head,
dim_head=dim_head,
dropout=dropout,
rotary_embed=rotary_embed_t,
)
forward
Source code in src/splifft/models/beat_this.py
98 99 100 101 102 103 104 105 106 107 | |
SumHead
SumHead(input_dim: int)
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
beat_downbeat_lin |
|
Source code in src/splifft/models/beat_this.py
111 112 113 | |
forward
Source code in src/splifft/models/beat_this.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
Head
Head(input_dim: int)
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
beat_downbeat_lin |
|
Source code in src/splifft/models/beat_this.py
133 134 135 | |
BeatThis
BeatThis(cfg: BeatThisParams)
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
:param x: Input spectrogram (B, T, F) |
Attributes:
| Name | Type | Description |
|---|---|---|
spect_dim |
|
|
frontend |
|
|
transformer_blocks |
|
|
task_heads |
|
Source code in src/splifft/models/beat_this.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | |
spect_dim
instance-attribute
spect_dim = spect_dim
frontend
instance-attribute
frontend = Sequential(
OrderedDict(
stem=stem,
blocks=Sequential(*frontend_blocks),
concat=Rearrange("b c f t -> b t (c f)"),
linear=Linear(dim * spect_dim, transformer_dim),
)
)
transformer_blocks
instance-attribute
transformer_blocks = Transformer(
dim=transformer_dim,
depth=n_layers,
dim_head=head_dim,
heads=n_heads,
attn_dropout=dropout_transformer,
ff_dropout=dropout_transformer,
ff_mult=ff_mult,
norm_output=True,
rotary_embed=rotary_embed_t,
transformer_residual_dtype=transformer_residual_dtype,
)
forward
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Input spectrogram (B, T, F) |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Logits (2, B, T) -> [Beats, Downbeats] |
Source code in src/splifft/models/beat_this.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | |
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:
MLPwas defined differently in each file, one that hasdepth - 1hidden layers and one that hasdepthlayers.BSRoformerapplies one final RMSNorm after the entire stack of transformer layers, while theMelBandRoformerapplies 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 compatibility with community-trained models. See: https://web.archive.org/web/20260112010548/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 |
|
BaselineMaskEstimatorConfig |
|
AxialRefinerLargeV2MaskEstimatorConfig |
unwa large-v2 head. Adds a small axial transformer refiner inside the mask head. |
HyperAceResidualV1MaskEstimatorConfig |
unwa HyperACE v1 residual head compatibility config. |
HyperAceResidualV2MaskEstimatorConfig |
UNWA HyperACE v2 residual head compatibility config. |
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 |
|
AxialRefinerLargeV2MaskEstimator |
|
HyperAceResidualMaskEstimator |
|
BSRoformer |
|
Functions:
| Name | Description |
|---|---|
l2norm |
|
rms_norm |
|
mlp |
|
Attributes:
| Name | Type | Description |
|---|---|---|
DEFAULT_FREQS_PER_BANDS |
|
|
MaskEstimatorConfig |
|
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"],
freqs_per_bands: tuple[Gt0[int], ...] = (
lambda: DEFAULT_FREQS_PER_BANDS
)(),
)
MelBandsConfig
dataclass
MelBandsConfig(
kind: Literal["mel"],
stft_n_fft: Gt0[int] = 2048,
num_bands: Gt0[int] = 60,
sample_rate: Gt0[int] = 44100,
)
BaselineMaskEstimatorConfig
dataclass
BaselineMaskEstimatorConfig(
kind: Literal["baseline"] = "baseline",
)
AxialRefinerLargeV2MaskEstimatorConfig
dataclass
AxialRefinerLargeV2MaskEstimatorConfig(
kind: Literal["axial_refiner_large_v2"],
axial_refiner_depth: Gt0[int] = 4,
)
unwa large-v2 head. Adds a small axial transformer refiner inside the mask head.
Attributes:
| Name | Type | Description |
|---|---|---|
kind |
Literal['axial_refiner_large_v2']
|
|
axial_refiner_depth |
Gt0[int]
|
|
HyperAceResidualV1MaskEstimatorConfig
dataclass
HyperAceResidualV1MaskEstimatorConfig(
kind: Literal["hyperace_residual_v1"],
num_hyperedges: Gt0[int] | None = None,
num_heads: Gt0[int] = 8,
)
HyperAceResidualV2MaskEstimatorConfig
dataclass
HyperAceResidualV2MaskEstimatorConfig(
kind: Literal["hyperace_residual_v2"],
num_hyperedges: Gt0[int] | None = None,
num_heads: Gt0[int] = 8,
)
MaskEstimatorConfig
module-attribute
MaskEstimatorConfig = (
BaselineMaskEstimatorConfig
| AxialRefinerLargeV2MaskEstimatorConfig
| HyperAceResidualV1MaskEstimatorConfig
| HyperAceResidualV2MaskEstimatorConfig
)
BSRoformerParams
dataclass
BSRoformerParams(
chunk_size: ChunkSize,
output_stem_names: tuple[ModelOutputStemName, ...],
dim: Gt0[int],
depth: Gt0[int],
band_config: FixedBandsConfig | MelBandsConfig,
stft_hop_length: HopSize = 512,
stereo: bool = True,
time_transformer_depth: Gt0[int] = 1,
freq_transformer_depth: Gt0[int] = 1,
linear_transformer_depth: Ge0[int] = 0,
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,
mask_estimator: MaskEstimatorConfig = BaselineMaskEstimatorConfig(),
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:
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.
mask_estimator
class-attribute
instance-attribute
mask_estimator: MaskEstimatorConfig = field(
default_factory=BaselineMaskEstimatorConfig
)
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
176 177 | |
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
181 182 183 184 | |
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
191 192 193 194 195 | |
scale
instance-attribute
scale = dim ** 0.5
eps
instance-attribute
eps = eps
forward
Source code in src/splifft/models/bs_roformer.py
197 198 199 200 201 | |
rms_norm
rms_norm(
dim: int, eps: float | None
) -> RMSNorm | RMSNormWithEps
Source code in src/splifft/models/bs_roformer.py
204 205 206 207 | |
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
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | |
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
245 246 247 248 249 | |
forward
Source code in src/splifft/models/bs_roformer.py
251 252 253 254 255 256 257 258 259 260 261 | |
FeedForward
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
net |
|
Source code in src/splifft/models/bs_roformer.py
265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
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
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | |
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
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | |
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
355 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 | |
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
391 392 393 394 395 396 397 398 399 400 401 | |
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
405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | |
transformer_residual_dtype
instance-attribute
transformer_residual_dtype = transformer_residual_dtype
forward
Source code in src/splifft/models/bs_roformer.py
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 | |
BandSplit
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
dim_inputs |
|
|
to_features |
|
Source code in src/splifft/models/bs_roformer.py
489 490 491 492 493 494 495 496 | |
dim_inputs
instance-attribute
dim_inputs = dim_inputs
forward
Source code in src/splifft/models/bs_roformer.py
498 499 500 501 502 503 504 | |
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
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | |
MaskEstimator
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
dim_inputs |
|
|
to_freqs |
|
Source code in src/splifft/models/bs_roformer.py
554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | |
dim_inputs
instance-attribute
dim_inputs = dim_inputs
to_freqs
instance-attribute
to_freqs = _build_band_to_freq_mlps(
dim=dim,
dim_inputs=dim_inputs,
depth=depth,
mlp_expansion_factor=mlp_expansion_factor,
)
forward
Source code in src/splifft/models/bs_roformer.py
570 571 572 573 574 575 576 577 578 579 | |
AxialRefinerLargeV2MaskEstimator
AxialRefinerLargeV2MaskEstimator(
dim: int,
dim_inputs: tuple[int, ...],
mlp_depth: int,
mlp_expansion_factor: int,
axial_refiner_depth: int,
t_frames: int,
num_bands: int,
rotary_embed_dtype: dtype | None,
)
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
dim_inputs |
|
|
to_freqs |
|
|
layers |
|
|
norm |
|
Source code in src/splifft/models/bs_roformer.py
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 646 647 648 649 650 651 | |
dim_inputs
instance-attribute
dim_inputs = dim_inputs
to_freqs
instance-attribute
to_freqs = _build_band_to_freq_mlps(
dim=dim,
dim_inputs=dim_inputs,
depth=mlp_depth,
mlp_expansion_factor=mlp_expansion_factor,
)
forward
Source code in src/splifft/models/bs_roformer.py
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 | |
HyperAceResidualMaskEstimator
HyperAceResidualMaskEstimator(
dim: int,
dim_inputs: tuple[int, ...],
depth: int,
mlp_expansion_factor: int,
segm: Module,
)
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
dim_inputs |
|
|
to_freqs |
|
|
segm |
|
Source code in src/splifft/models/bs_roformer.py
685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 | |
dim_inputs
instance-attribute
dim_inputs = dim_inputs
to_freqs
instance-attribute
to_freqs = _build_band_to_freq_mlps(
dim=dim,
dim_inputs=dim_inputs,
depth=depth,
mlp_expansion_factor=mlp_expansion_factor,
)
segm
instance-attribute
segm = segm
forward
Source code in src/splifft/models/bs_roformer.py
704 705 706 707 708 709 710 711 712 713 714 715 | |
BSRoformer
BSRoformer(cfg: BSRoformerParams)
Bases: Module, SupportsStemSelection[BSRoformerParams]
Methods:
| Name | Description |
|---|---|
forward |
:param stft_repr: input spectrogram. shape (b, f*s, t, c) |
__splifft_stem_selection_plan__ |
Remap |
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
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 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 | |
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
901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 | |
__splifft_stem_selection_plan__
classmethod
__splifft_stem_selection_plan__(
model_params: BSRoformerParams,
output_stem_names: tuple[ModelOutputStemName, ...],
) -> StemSelectionPlan[BSRoformerParams]
Remap mask_estimators.{i}.* state-dict entries to a compact
[0..k) index range so unrelated per-stem heads are never instantiated
or loaded.
Source code in src/splifft/models/bs_roformer.py
1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 | |
mdx23c
MDX23C.
See: https://arxiv.org/pdf/2306.09382
Classes:
| Name | Description |
|---|---|
MDX23CParams |
|
Upscale |
|
Downscale |
|
MDX23C |
|
Functions:
| Name | Description |
|---|---|
get_norm |
|
get_act |
|
build_tfc_tdf |
|
MDX23CParams
dataclass
MDX23CParams(
chunk_size: ChunkSize,
output_stem_names: tuple[ModelOutputStemName, ...],
dim_f: Gt0[int],
num_subbands: Gt0[int],
num_scales: Gt0[int],
scale: tuple[Gt0[int], ...],
num_blocks_per_scale: Gt0[int],
hidden_channels: Gt0[int],
growth: Gt0[int],
bottleneck_factor: Gt0[int],
norm_type: Literal["BatchNorm", "InstanceNorm"]
| str = "InstanceNorm",
act_type: Literal["gelu", "relu", "elu"] | str = "gelu",
stereo: bool = True,
)
Bases: ModelParamsLike
Attributes:
| Name | Type | Description |
|---|---|---|
chunk_size |
ChunkSize
|
|
output_stem_names |
tuple[ModelOutputStemName, ...]
|
|
dim_f |
Gt0[int]
|
The size of the frequency dimension fed into the network. |
num_subbands |
Gt0[int]
|
|
num_scales |
Gt0[int]
|
|
scale |
tuple[Gt0[int], ...]
|
Downscaling factor per scale. |
num_blocks_per_scale |
Gt0[int]
|
|
hidden_channels |
Gt0[int]
|
Base number of channels. |
growth |
Gt0[int]
|
Channel growth per scale. |
bottleneck_factor |
Gt0[int]
|
|
norm_type |
Literal['BatchNorm', 'InstanceNorm'] | str
|
|
act_type |
Literal['gelu', 'relu', 'elu'] | str
|
|
stereo |
bool
|
|
input_channels |
ModelInputChannels
|
|
input_type |
ModelInputType
|
|
output_type |
ModelOutputType
|
|
inference_archetype |
InferenceArchetype
|
|
dim_f
instance-attribute
The size of the frequency dimension fed into the network.
Usually smaller than n_fft // 2 + 1.
norm_type
class-attribute
instance-attribute
get_norm
Source code in src/splifft/models/mdx23c.py
61 62 63 64 65 66 67 68 69 | |
get_act
Source code in src/splifft/models/mdx23c.py
72 73 74 75 76 77 78 79 80 81 82 83 | |
build_tfc_tdf
build_tfc_tdf(
in_c: int,
c: int,
blocks_per_scale: int,
f: int,
bn: int,
norm_type: str,
act_type: str,
) -> TfcTdf
Source code in src/splifft/models/mdx23c.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
Upscale
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
conv |
|
Source code in src/splifft/models/mdx23c.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
conv
instance-attribute
conv = Sequential(
get_norm(norm_type, in_c),
get_act(act_type),
ConvTranspose2d(
in_channels=in_c,
out_channels=out_c,
kernel_size=scale,
stride=scale,
bias=False,
),
)
Downscale
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
conv |
|
Source code in src/splifft/models/mdx23c.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
conv
instance-attribute
conv = Sequential(
get_norm(norm_type, in_c),
get_act(act_type),
Conv2d(
in_channels=in_c,
out_channels=out_c,
kernel_size=scale,
stride=scale,
bias=False,
),
)
MDX23C
MDX23C(cfg: MDX23CParams)
Bases: Module, SupportsStemSelection[MDX23CParams]
Methods:
| Name | Description |
|---|---|
cac2cws |
|
cws2cac |
|
forward |
:param x: input spectrogram (B, F*S, T, 2) |
__splifft_stem_selection_plan__ |
Slice |
Attributes:
| Name | Type | Description |
|---|---|---|
cfg |
|
|
num_target_instruments |
|
|
audio_channels |
|
|
num_subbands |
|
|
first_conv |
|
|
encoder_blocks |
|
|
bottleneck_block |
|
|
decoder_blocks |
|
|
final_conv |
|
Source code in src/splifft/models/mdx23c.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | |
cfg
instance-attribute
cfg = cfg
audio_channels
instance-attribute
audio_channels = 2 if stereo else 1
num_subbands
instance-attribute
num_subbands = num_subbands
bottleneck_block
instance-attribute
bottleneck_block = build_tfc_tdf(
c, c, blocks_per_scale, f, bn, norm_type, act_type
)
final_conv
instance-attribute
final_conv = Sequential(
Conv2d(c + dim_c, c, 1, 1, 0, bias=False),
get_act(act_type),
Conv2d(
c,
num_target_instruments * dim_c,
1,
1,
0,
bias=False,
),
)
cac2cws
Source code in src/splifft/models/mdx23c.py
211 212 | |
cws2cac
Source code in src/splifft/models/mdx23c.py
214 215 | |
forward
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
input spectrogram (B, F*S, T, 2) |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
output spectrogram (B, N, F*S, T, 2) |
Source code in src/splifft/models/mdx23c.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 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 278 | |
__splifft_stem_selection_plan__
classmethod
__splifft_stem_selection_plan__(
model_params: MDX23CParams,
output_stem_names: tuple[ModelOutputStemName, ...],
) -> StemSelectionPlan[MDX23CParams]
Slice final_conv.2 per requested stem.
Source code in src/splifft/models/mdx23c.py
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 | |
basic_pitch
ICASSP 2022 Basic Pitch. Raw multi-stream outputs only, no symbolic decoding.
See: https://github.com/spotify/basic-pitch, https://arxiv.org/abs/2203.09893
Classes:
| Name | Description |
|---|---|
BasicPitchParams |
|
HarmonicStacking |
|
BasicPitch |
|
BasicPitchParams
dataclass
BasicPitchParams(
chunk_size: ChunkSize,
output_stem_names: tuple[ModelOutputStemName, ...],
n_semitones: Gt0[int] = 88,
contour_bins_per_semitone: Gt0[int] = 3,
cqt_bins_per_semitone: Gt0[int] = 3,
cqt_n_bins: Gt0[int] = 372,
stack_harmonics: tuple[Gt0[float], ...] = (
0.5,
1.0,
2.0,
3.0,
4.0,
5.0,
6.0,
7.0,
),
)
Bases: ModelParamsLike
Attributes:
contour_bins_per_semitone
class-attribute
instance-attribute
stack_harmonics
class-attribute
instance-attribute
HarmonicStacking
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
:param x: (B, T, F) |
Attributes:
| Name | Type | Description |
|---|---|---|
n_output_freqs |
|
|
shifts |
|
Source code in src/splifft/models/basic_pitch.py
51 52 53 54 55 56 57 58 59 60 | |
n_output_freqs
instance-attribute
n_output_freqs = n_output_freqs
shifts
instance-attribute
forward
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
(B, T, F) |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
(B, H, T, F_out) |
Source code in src/splifft/models/basic_pitch.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
BasicPitch
BasicPitch(cfg: BasicPitchParams)
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
cfg |
|
|
n_contour_bins |
|
|
hs |
|
|
conv_contour |
|
|
conv_note |
|
|
conv_onset_pre |
|
|
conv_onset_post |
|
Source code in src/splifft/models/basic_pitch.py
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 | |
cfg
instance-attribute
cfg = cfg
n_contour_bins
instance-attribute
n_contour_bins = n_semitones * contour_bins_per_semitone
hs
instance-attribute
hs = HarmonicStacking(
bins_per_semitone=cqt_bins_per_semitone,
harmonics=stack_harmonics,
n_output_freqs=n_contour_bins,
)
conv_contour
instance-attribute
conv_contour = Sequential(
Conv2d(
num_in_channels,
8,
kernel_size=(3, 39),
padding="same",
),
BatchNorm2d(8, eps=0.001),
ReLU(),
Conv2d(8, 1, kernel_size=5, padding="same"),
Sigmoid(),
)
conv_note
instance-attribute
conv_note = Sequential(
Conv2d(1, 32, kernel_size=7, stride=(1, 3)),
ReLU(),
Conv2d(32, 1, kernel_size=(7, 3), padding="same"),
Sigmoid(),
)
conv_onset_pre
instance-attribute
conv_onset_pre = Sequential(
Conv2d(
num_in_channels, 32, kernel_size=5, stride=(1, 3)
),
BatchNorm2d(32, eps=0.001),
ReLU(),
)
conv_onset_post
instance-attribute
conv_onset_post = Sequential(
Conv2d(33, 1, kernel_size=3, stride=1, padding="same"),
Sigmoid(),
)
forward
Source code in src/splifft/models/basic_pitch.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | |
utils
Modules:
| Name | Description |
|---|---|
attend |
|
attend_sage |
|
hyperace |
HyperACE segmentation backbones for BS-RoFormer mask heads. |
stft |
|
tfc_tdf |
Time-Frequency Convolutions and Time-Distributed Fully-connected (TFC-TDF) |
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 | |
tfc_tdf
Time-Frequency Convolutions and Time-Distributed Fully-connected (TFC-TDF)
See: https://arxiv.org/pdf/2306.09382
Classes:
| Name | Description |
|---|---|
TfcTdfBlock |
|
TfcTdf |
|
Functions:
| Name | Description |
|---|---|
instance_norm_factory |
|
silu_factory |
|
Attributes:
| Name | Type | Description |
|---|---|---|
NormFactory |
|
|
ActFactory |
|
instance_norm_factory
Source code in src/splifft/models/utils/tfc_tdf.py
16 17 | |
silu_factory
silu_factory() -> Module
Source code in src/splifft/models/utils/tfc_tdf.py
20 21 | |
TfcTdfBlock
TfcTdfBlock(
in_channels: int,
out_channels: int,
f_bins: int,
bottleneck_factor: int,
*,
norm_factory: NormFactory,
act_factory: ActFactory,
)
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
tfc1 |
|
|
tdf |
|
|
tfc2 |
|
|
shortcut |
|
Source code in src/splifft/models/utils/tfc_tdf.py
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 | |
tfc1
instance-attribute
tfc1 = Sequential(
norm_factory(in_channels),
act_factory(),
Conv2d(in_channels, out_channels, 3, 1, 1, bias=False),
)
tdf
instance-attribute
tdf = Sequential(
norm_factory(out_channels),
act_factory(),
Linear(f_bins, f_bins // bottleneck_factor, bias=False),
norm_factory(out_channels),
act_factory(),
Linear(f_bins // bottleneck_factor, f_bins, bias=False),
)
tfc2
instance-attribute
tfc2 = Sequential(
norm_factory(out_channels),
act_factory(),
Conv2d(out_channels, out_channels, 3, 1, 1, bias=False),
)
TfcTdf
TfcTdf(
in_channels: int,
out_channels: int,
num_blocks: int,
f_bins: int,
bottleneck_factor: int,
*,
norm_factory: NormFactory,
act_factory: ActFactory,
)
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
blocks |
|
Source code in src/splifft/models/utils/tfc_tdf.py
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 | |
blocks
instance-attribute
blocks = ModuleList(
[
(
TfcTdfBlock(
in_channels=in_channels
if i == 0
else out_channels,
out_channels=out_channels,
f_bins=f_bins,
bottleneck_factor=bottleneck_factor,
norm_factory=norm_factory,
act_factory=act_factory,
)
)
for i in (range(num_blocks))
]
)
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 | |
hyperace
HyperACE segmentation backbones for BS-RoFormer mask heads.
These modules are compatibility shims for unwa variants trained in msst
(hyperace_v1, hyperace_v2, and large_inst_v2 head behavior). They are
kept separate from the core transformer stack because they are used only by a
small subset of checkpoints.
See: https://huggingface.co/pcunwa/BS-Roformer-HyperACE and https://arxiv.org/abs/2506.17733
Classes:
Functions:
| Name | Description |
|---|---|
autopad |
|
build_hyperace_tfc_tdf |
|
autopad
autopad(
k: int | tuple[int, int],
p: int | tuple[int, int] | None = None,
) -> int | tuple[int, int]
Source code in src/splifft/models/utils/hyperace.py
24 25 26 27 28 29 30 | |
build_hyperace_tfc_tdf
Source code in src/splifft/models/utils/hyperace.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |
Conv
Conv(
c1: int,
c2: int,
k: int | tuple[int, int] = 1,
s: int | tuple[int, int] = 1,
p: int | tuple[int, int] | None = None,
g: int = 1,
act: bool = True,
)
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
conv |
|
|
bn |
|
|
act |
|
Source code in src/splifft/models/utils/hyperace.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
DSConv
DSConv(
c1: int,
c2: int,
k: int | tuple[int, int] = 3,
s: int | tuple[int, int] = 1,
p: int | tuple[int, int] | None = None,
act: bool = True,
)
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
dwconv |
|
|
pwconv |
|
|
bn |
|
|
act |
|
Source code in src/splifft/models/utils/hyperace.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
DS_Bottleneck
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
dsconv1 |
|
|
dsconv2 |
|
|
shortcut |
|
Source code in src/splifft/models/utils/hyperace.py
92 93 94 95 96 97 | |
shortcut
instance-attribute
shortcut = shortcut and c1 == c2
DS_C3k
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
cv1 |
|
|
cv2 |
|
|
cv3 |
|
|
m |
|
Source code in src/splifft/models/utils/hyperace.py
106 107 108 109 110 111 112 | |
m
instance-attribute
m = Sequential(
*[
(DS_Bottleneck(c_, c_, k=k, shortcut=True))
for _ in (range(n))
]
)
DS_C3k2
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
cv1 |
|
|
m |
|
|
cv2 |
|
Source code in src/splifft/models/utils/hyperace.py
119 120 121 122 123 124 | |
AdaptiveHyperedgeGeneration
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
num_hyperedges |
|
|
num_heads |
|
|
head_dim |
|
|
global_proto |
|
|
context_mapper |
|
|
query_proj |
|
|
scale |
|
Source code in src/splifft/models/utils/hyperace.py
133 134 135 136 137 138 139 140 141 142 143 144 145 | |
num_hyperedges
instance-attribute
num_hyperedges = num_hyperedges
num_heads
instance-attribute
num_heads = num_heads
head_dim
instance-attribute
head_dim = in_channels // num_heads
context_mapper
instance-attribute
context_mapper = Linear(
2 * in_channels,
num_hyperedges * in_channels,
bias=False,
)
scale
instance-attribute
scale = head_dim ** -0.5
forward
Source code in src/splifft/models/utils/hyperace.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
HypergraphConvolution
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
W_e |
|
|
W_v |
|
|
act |
|
Source code in src/splifft/models/utils/hyperace.py
173 174 175 176 177 | |
forward
Source code in src/splifft/models/utils/hyperace.py
179 180 181 182 183 184 185 186 | |
AdaptiveHypergraphComputation
AdaptiveHypergraphComputation(
in_channels: int,
out_channels: int,
num_hyperedges: int = 8,
num_heads: int = 8,
)
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
adaptive_hyperedge_gen |
|
|
hypergraph_conv |
|
Source code in src/splifft/models/utils/hyperace.py
190 191 192 193 194 195 196 197 198 199 200 201 | |
adaptive_hyperedge_gen
instance-attribute
adaptive_hyperedge_gen = AdaptiveHyperedgeGeneration(
in_channels, num_hyperedges, num_heads
)
hypergraph_conv
instance-attribute
hypergraph_conv = HypergraphConvolution(
in_channels, out_channels
)
forward
Source code in src/splifft/models/utils/hyperace.py
203 204 205 206 207 208 209 210 211 212 | |
C3AH
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
cv1 |
|
|
cv2 |
|
|
ahc |
|
|
cv3 |
|
Source code in src/splifft/models/utils/hyperace.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 | |
HyperACE
HyperACE(
in_channels: list[int],
out_channels: int,
num_hyperedges: int = 8,
num_heads: int = 8,
k: int = 2,
l: int = 1,
c_h: float = 0.5,
c_l: float = 0.25,
)
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
fuse_conv |
|
|
c_h |
|
|
c_l |
|
|
c_s |
|
|
high_order_branch |
|
|
high_order_fuse |
|
|
low_order_branch |
|
|
final_fuse |
|
Source code in src/splifft/models/utils/hyperace.py
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 | |
c_s
instance-attribute
c_s = c_mid - c_h - c_l
high_order_branch
instance-attribute
high_order_branch = ModuleList(
[
(C3AH(c_h, c_h, num_hyperedges, num_heads, e=1.0))
for _ in (range(k))
]
)
low_order_branch
instance-attribute
low_order_branch = Sequential(
*[
(DS_C3k(c_l, c_l, n=1, k=3, e=1.0))
for _ in (range(l))
]
)
forward
Source code in src/splifft/models/utils/hyperace.py
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | |
GatedFusion
GatedFusion(in_channels: int)
BackboneHyperAceV1
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
stem |
|
|
p2 |
|
|
p3 |
|
|
p4 |
|
|
p5 |
|
|
out_channels |
|
Source code in src/splifft/models/utils/hyperace.py
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 | |
p2
instance-attribute
p2 = Sequential(
DSConv(c2, c3, k=3, s=(2, 1), p=1),
DS_C3k2(c3, c3, n=base_depth),
)
p3
instance-attribute
p3 = Sequential(
DSConv(c3, c4, k=3, s=(2, 1), p=1),
DS_C3k2(c4, c4, n=base_depth * 2),
)
p4
instance-attribute
p4 = Sequential(
DSConv(c4, c5, k=3, s=(2, 1), p=1),
DS_C3k2(c5, c5, n=base_depth * 2),
)
p5
instance-attribute
p5 = Sequential(
DSConv(c5, c6, k=3, s=(2, 1), p=1),
DS_C3k2(c6, c6, n=base_depth),
)
out_channels
instance-attribute
out_channels = [c3, c4, c5, c6]
BackboneHyperAceV2
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
stem |
|
|
p2 |
|
|
p3 |
|
|
p4 |
|
|
p5 |
|
|
out_channels |
|
Source code in src/splifft/models/utils/hyperace.py
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | |
p2
instance-attribute
p2 = Sequential(
DSConv(c2, c3, k=3, s=(2, 1), p=1),
DS_C3k2(c3, c3, n=base_depth),
)
p3
instance-attribute
p3 = Sequential(
DSConv(c3, c4, k=3, s=(2, 1), p=1),
DS_C3k2(c4, c4, n=base_depth * 2),
)
p4
instance-attribute
p4 = Sequential(
DSConv(c4, c5, k=3, s=2, p=1),
DS_C3k2(c5, c5, n=base_depth * 2),
)
p5
instance-attribute
p5 = Sequential(
DSConv(c5, c6, k=3, s=2, p=1),
DS_C3k2(c6, c6, n=base_depth),
)
out_channels
instance-attribute
out_channels = [c3, c4, c5, c6]
DecoderHyperAce
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
h_to_d5 |
|
|
h_to_d4 |
|
|
h_to_d3 |
|
|
h_to_d2 |
|
|
fusion_d5 |
|
|
fusion_d4 |
|
|
fusion_d3 |
|
|
fusion_d2 |
|
|
skip_p5 |
|
|
skip_p4 |
|
|
skip_p3 |
|
|
skip_p2 |
|
|
up_d5 |
|
|
up_d4 |
|
|
up_d3 |
|
|
final_d2 |
|
Source code in src/splifft/models/utils/hyperace.py
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | |
forward
Source code in src/splifft/models/utils/hyperace.py
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 | |
FreqPixelShuffleV1
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
scale |
|
|
conv |
|
Source code in src/splifft/models/utils/hyperace.py
453 454 455 456 | |
scale
instance-attribute
scale = scale
forward
Source code in src/splifft/models/utils/hyperace.py
458 459 460 461 462 463 464 465 466 467 468 | |
ProgressiveUpsampleHeadV1
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
target_bins |
|
|
block1 |
|
|
block2 |
|
|
block3 |
|
|
block4 |
|
|
final_conv |
|
Source code in src/splifft/models/utils/hyperace.py
472 473 474 475 476 477 478 479 480 481 482 483 | |
target_bins
instance-attribute
target_bins = target_bins
final_conv
instance-attribute
final_conv = Conv2d(
c // 4, out_channels, kernel_size=1, bias=False
)
forward
Source code in src/splifft/models/utils/hyperace.py
485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | |
FreqPixelShuffleV2
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
scale |
|
|
conv |
|
|
out_conv |
|
Source code in src/splifft/models/utils/hyperace.py
504 505 506 507 508 | |
scale
instance-attribute
scale = scale
forward
Source code in src/splifft/models/utils/hyperace.py
510 511 512 513 514 515 516 517 518 519 520 | |
ProgressiveUpsampleHeadV2
ProgressiveUpsampleHeadV2(
in_channels: int,
out_channels: int,
target_bins: int = 1025,
in_bands: int = 62,
)
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
target_bins |
|
|
block1 |
|
|
block2 |
|
|
block3 |
|
|
block4 |
|
|
final_conv |
|
Source code in src/splifft/models/utils/hyperace.py
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 | |
target_bins
instance-attribute
target_bins = target_bins
final_conv
instance-attribute
final_conv = Conv2d(
c // 16,
out_channels,
kernel_size=3,
stride=1,
padding="same",
bias=False,
)
forward
Source code in src/splifft/models/utils/hyperace.py
546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 | |
SegmModelHyperAceV1
SegmModelHyperAceV1(
in_bands: int = 62,
in_dim: int = 256,
out_bins: int = 1025,
out_channels: int = 4,
base_channels: int = 64,
base_depth: int = 2,
num_hyperedges: int = 16,
num_heads: int = 8,
)
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
backbone |
|
|
hyperace |
|
|
decoder |
|
|
upsample_head |
|
Source code in src/splifft/models/utils/hyperace.py
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 | |
backbone
instance-attribute
backbone = BackboneHyperAceV1(
in_channels=in_dim,
base_channels=base_channels,
base_depth=base_depth,
)
hyperace
instance-attribute
hyperace = HyperACE(
hyperace_in_channels,
hyperace_out_channels,
num_hyperedges,
num_heads,
k=3,
l=2,
)
decoder
instance-attribute
decoder = DecoderHyperAce(
enc_channels, hyperace_out_channels, decoder_channels
)
upsample_head
instance-attribute
upsample_head = ProgressiveUpsampleHeadV1(
in_channels=decoder_channels[0],
out_channels=out_channels,
target_bins=out_bins,
)
forward
Source code in src/splifft/models/utils/hyperace.py
606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 | |
SegmModelHyperAceV2
SegmModelHyperAceV2(
in_bands: int = 62,
in_dim: int = 256,
out_bins: int = 1025,
out_channels: int = 4,
base_channels: int = 64,
base_depth: int = 2,
num_hyperedges: int = 32,
num_heads: int = 8,
)
Bases: Module
Methods:
| Name | Description |
|---|---|
forward |
|
Attributes:
| Name | Type | Description |
|---|---|---|
backbone |
|
|
hyperace |
|
|
decoder |
|
|
upsample_head |
|
Source code in src/splifft/models/utils/hyperace.py
628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | |
backbone
instance-attribute
backbone = BackboneHyperAceV2(
in_channels=in_dim,
base_channels=base_channels,
base_depth=base_depth,
)
hyperace
instance-attribute
hyperace = HyperACE(
hyperace_in_channels,
hyperace_out_channels,
num_hyperedges,
num_heads,
k=2,
l=1,
)
decoder
instance-attribute
decoder = DecoderHyperAce(
enc_channels, hyperace_out_channels, decoder_channels
)
upsample_head
instance-attribute
upsample_head = ProgressiveUpsampleHeadV2(
in_channels=decoder_channels[0],
out_channels=out_channels,
target_bins=out_bins,
in_bands=in_bands,
)
forward
Source code in src/splifft/models/utils/hyperace.py
670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 | |