Config
config
Configuration
Classes:
| Name | Description |
|---|---|
ModelStemNames |
|
LazyModelConfig |
A lazily validated model configuration. |
StftConfig |
configuration for the short-time fourier transform. |
LogMelConfig |
Configuration for Log-Mel Spectrogram. |
HcqtRegularConfig |
Configuration for regular harmonic CQT using one full-band kernel bank |
HcqtRecursiveConfig |
Configuration for recursive harmonic CQT. |
AudioIOConfig |
|
TorchCompileConfig |
|
InferenceConfig |
|
NormalizationConfig |
|
WaveformChunkingConfig |
|
SequenceChunkingConfig |
|
MaskingConfig |
|
SubtractConfig |
|
SumConfig |
|
OutputConfig |
|
ConfigOverrideError |
Raised when one or more override strings are syntactically invalid. |
ParsedConfigOverride |
|
Config |
|
Model |
|
Metrics |
|
Resource |
|
Comment |
|
Registry |
|
Functions:
| Name | Description |
|---|---|
parse_override_value |
Parse a CLI override value into a Python object. |
parse_config_override |
Parse one override entry of the form |
set_path_value |
Set a nested value in-place, creating missing dictionaries as needed. |
apply_config_overrides |
|
load_config_dict |
|
into_config |
Convert various config inputs into a validated [ |
Attributes:
| Name | Type | Description |
|---|---|---|
TorchDtype |
TypeAlias
|
|
Tuple |
|
|
NonEmptyUnique |
|
|
ModelInputStemName |
TypeAlias
|
|
ModelOutputStemName |
TypeAlias
|
|
FeatureExtractionConfig |
TypeAlias
|
|
DerivedStemName |
TypeAlias
|
The name of a derived stem, e.g. |
StemName |
TypeAlias
|
A name of a stem, either a model output stem or a derived stem. |
DerivedStemRule |
TypeAlias
|
|
DerivedStemsConfig |
TypeAlias
|
|
ConfigOverrides |
TypeAlias
|
|
IntoConfig |
TypeAlias
|
|
TorchDtype
module-attribute
TorchDtype: TypeAlias = Annotated[
dtype, GetPydanticSchema(_get_torch_dtype_schema)
]
NonEmptyUnique
module-attribute
NonEmptyUnique = Annotated[
_S,
Len(min_length=1),
AfterValidator(_validate_unique_sequence),
Field(json_schema_extra={"unique_items": True}),
]
ModelOutputStemName
module-attribute
ModelOutputStemName: TypeAlias = Annotated[
ModelOutputStemName, StringConstraints(min_length=1)
]
ModelStemNames
Bases: NamedTuple
Attributes:
| Name | Type | Description |
|---|---|---|
input_stem_names |
tuple[ModelInputStemName, ...]
|
|
output_stem_names |
tuple[ModelOutputStemName, ...]
|
|
LazyModelConfig
Bases: BaseModel
A lazily validated model configuration.
Note that it is not guaranteed to be fully valid until to_concrete is called.
Methods:
| Name | Description |
|---|---|
to_concrete |
Validate against a real set of model parameters and convert to it. |
Attributes:
| Name | Type | Description |
|---|---|---|
chunk_size |
ChunkSize
|
|
output_stem_names |
NonEmptyUnique[Tuple[ModelOutputStemName]]
|
|
stem_names |
ModelStemNames
|
Returns the model's input and output stem names grouped by role. |
model_config |
|
output_stem_names
instance-attribute
output_stem_names: NonEmptyUnique[
Tuple[ModelOutputStemName]
]
to_concrete
to_concrete(
model_params: type[ModelParamsLikeT],
*,
pydantic_config: ConfigDict = ConfigDict(
extra="forbid"
),
) -> ModelParamsLikeT
Validate against a real set of model parameters and convert to it.
Raises:
| Type | Description |
|---|---|
pydantic.ValidationError
|
if extra fields are present in the model parameters that doesn't exist in the concrete model parameters. |
Source code in src/splifft/config.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
stem_names
property
stem_names: ModelStemNames
Returns the model's input and output stem names grouped by role.
model_config
class-attribute
instance-attribute
model_config = ConfigDict(strict=True, extra='allow')
StftConfig
Bases: BaseModel
configuration for the short-time fourier transform.
Attributes:
| Name | Type | Description |
|---|---|---|
kind |
Literal['stft']
|
|
n_fft |
FftSize
|
|
hop_length |
HopSize
|
|
win_length |
FftSize
|
|
window_shape |
WindowShape
|
|
normalized |
bool
|
|
conv_dtype |
TorchDtype | None
|
The data type used for the |
model_config |
|
conv_dtype
class-attribute
instance-attribute
conv_dtype: TorchDtype | None = None
The data type used for the conv1d buffers.
model_config
class-attribute
instance-attribute
model_config = _PYDANTIC_STRICT_CONFIG
LogMelConfig
Bases: BaseModel
Configuration for Log-Mel Spectrogram.
Attributes:
| Name | Type | Description |
|---|---|---|
kind |
Literal['mel']
|
|
n_fft |
FftSize
|
|
hop_length |
HopSize
|
|
n_mels |
Gt0[int]
|
|
sample_rate |
SampleRate
|
|
f_min |
float
|
|
f_max |
float | None
|
|
mel_scale |
Literal['htk', 'slaney']
|
|
normalized |
bool | Literal['frame_length']
|
|
power |
float
|
|
log_multiplier |
float
|
|
model_config |
|
normalized
class-attribute
instance-attribute
model_config
class-attribute
instance-attribute
model_config = _PYDANTIC_STRICT_CONFIG
HcqtRegularConfig
Bases: BaseModel
Configuration for regular harmonic CQT using one full-band kernel bank per harmonic.
Attributes:
| Name | Type | Description |
|---|---|---|
kind |
Literal['hcqt_regular']
|
|
hop_size_ms |
Gt0[float]
|
|
harmonics |
NonEmptyUnique[Tuple[Gt0[int]]]
|
|
fmin |
Gt0[float]
|
|
bins_per_semitone |
Gt0[int]
|
|
n_bins |
Gt0[int]
|
|
center_bins |
bool
|
|
gamma |
Ge0[float]
|
|
center |
bool
|
|
filter_scale |
Gt0[float]
|
|
window |
Literal['hann', 'hamming']
|
|
log_epsilon |
Gt0[float]
|
|
power_epsilon |
Ge0[float] | None
|
|
model_config |
|
model_config
class-attribute
instance-attribute
model_config = _PYDANTIC_STRICT_CONFIG
HcqtRecursiveConfig
Bases: BaseModel
Configuration for recursive harmonic CQT.
Attributes:
| Name | Type | Description |
|---|---|---|
kind |
Literal['hcqt_recursive']
|
|
hop_size_ms |
Gt0[float]
|
|
harmonics |
NonEmptyUnique[Tuple[Gt0[int]]]
|
|
fmin |
Gt0[float]
|
|
bins_per_semitone |
Gt0[int]
|
|
n_bins |
Gt0[int]
|
|
center_bins |
bool
|
|
center |
bool
|
|
log_epsilon |
Gt0[float]
|
|
power_epsilon |
Ge0[float] | None
|
|
model_config |
|
model_config
class-attribute
instance-attribute
model_config = _PYDANTIC_STRICT_CONFIG
FeatureExtractionConfig
module-attribute
FeatureExtractionConfig: TypeAlias = Annotated[
Union[
StftConfig,
LogMelConfig,
HcqtRegularConfig,
HcqtRecursiveConfig,
],
Discriminator("kind"),
]
AudioIOConfig
Bases: BaseModel
Attributes:
| Name | Type | Description |
|---|---|---|
target_sample_rate |
SampleRate
|
|
force_channels |
Channels | None
|
Whether to force mono or stereo audio input. If None, keep original. |
model_config |
|
force_channels
class-attribute
instance-attribute
force_channels: Channels | None = 2
Whether to force mono or stereo audio input. If None, keep original.
model_config
class-attribute
instance-attribute
model_config = _PYDANTIC_STRICT_CONFIG
TorchCompileConfig
InferenceConfig
Bases: BaseModel
Attributes:
| Name | Type | Description |
|---|---|---|
batch_size |
BatchSize
|
|
requested_stems |
NonEmptyUnique[Tuple[ModelOutputStemName]] | None
|
Optional subset of model output stems to compute and emit. |
force_weights_dtype |
TorchDtype | None
|
|
use_autocast_dtype |
TorchDtype | None
|
|
model_device |
str | None
|
Device used for model forward execution. |
io_device |
str | None
|
Device for audio IO and non-model tensor ops (chunking/stitching/output/normalization). |
compile_model |
TorchCompileConfig | None
|
|
model_config |
|
requested_stems
class-attribute
instance-attribute
requested_stems: (
NonEmptyUnique[Tuple[ModelOutputStemName]] | None
) = None
Optional subset of model output stems to compute and emit.
When provided, inference only computes/keeps these model outputs in the configured order. Depending on the model architecture, this may allow specific stem-specific weights to be not loaded at all.
For example, the BS Roformer architecture has a shared backbone followed by multiple MLP heads, so setting this parameter can effectively patch out the unrelated heads.
force_weights_dtype
class-attribute
instance-attribute
force_weights_dtype: TorchDtype | None = None
model_device
class-attribute
instance-attribute
model_device: str | None = None
Device used for model forward execution.
If None, runtime auto-selects cuda when available, otherwise cpu.
io_device
class-attribute
instance-attribute
io_device: str | None = None
Device for audio IO and non-model tensor ops (chunking/stitching/output/normalization).
If None, runtime auto-selects cuda when available, otherwise cpu.
Note that switching io_device to CPU is expected to break bit-identical
parity vs io_device="cuda" even with identical weights/seeds.
core.normalize_audiooutput/stat-mean (tiny CPU vs CUDA reduction drift)core._get_window_fn(tiny kernel-level float differences)core.generate_chunksandcore.stitch_chunksmay then differ bitwise
model_config
class-attribute
instance-attribute
model_config = _PYDANTIC_STRICT_CONFIG
NormalizationConfig
Bases: BaseModel
Attributes:
| Name | Type | Description |
|---|---|---|
enabled |
bool
|
|
model_config |
|
model_config
class-attribute
instance-attribute
model_config = _PYDANTIC_STRICT_CONFIG
WaveformChunkingConfig
Bases: BaseModel
Attributes:
| Name | Type | Description |
|---|---|---|
method |
Literal['overlap_add_windowed']
|
|
overlap_ratio |
OverlapRatio
|
|
window_shape |
WindowShape
|
|
padding_mode |
PaddingMode
|
|
model_config |
|
method
class-attribute
instance-attribute
method: Literal["overlap_add_windowed"] = (
"overlap_add_windowed"
)
model_config
class-attribute
instance-attribute
model_config = _PYDANTIC_STRICT_CONFIG
SequenceChunkingConfig
Bases: BaseModel
Attributes:
| Name | Type | Description |
|---|---|---|
trim_margin |
TrimMargin
|
|
overlap_mode |
OverlapMode
|
|
avoid_short_end |
bool
|
|
model_config |
|
model_config
class-attribute
instance-attribute
model_config = _PYDANTIC_STRICT_CONFIG
MaskingConfig
Bases: BaseModel
Attributes:
| Name | Type | Description |
|---|---|---|
add_sub_dtype |
TorchDtype | None
|
|
out_dtype |
TorchDtype | None
|
|
model_config |
|
model_config
class-attribute
instance-attribute
model_config = _PYDANTIC_STRICT_CONFIG
DerivedStemName
module-attribute
DerivedStemName: TypeAlias = Annotated[
str, StringConstraints(min_length=1)
]
The name of a derived stem, e.g. vocals_minus_drums.
StemName
module-attribute
StemName: TypeAlias = Union[
ModelOutputStemName, DerivedStemName
]
A name of a stem, either a model output stem or a derived stem.
SubtractConfig
Bases: BaseModel
Attributes:
| Name | Type | Description |
|---|---|---|
operation |
Literal['subtract']
|
|
stem_name |
StemName
|
|
by_stem_name |
StemName
|
|
model_config |
|
SumConfig
Bases: BaseModel
Attributes:
| Name | Type | Description |
|---|---|---|
operation |
Literal['sum']
|
|
stem_names |
NonEmptyUnique[Tuple[StemName]]
|
|
model_config |
|
model_config
class-attribute
instance-attribute
model_config = _PYDANTIC_STRICT_CONFIG
DerivedStemRule
module-attribute
DerivedStemRule: TypeAlias = Annotated[
Union[SubtractConfig, SumConfig],
Discriminator("operation"),
]
DerivedStemsConfig
module-attribute
DerivedStemsConfig: TypeAlias = dict[
DerivedStemName, DerivedStemRule
]
OutputConfig
Bases: BaseModel
Attributes:
| Name | Type | Description |
|---|---|---|
stem_names |
Literal['all'] | NonEmptyUnique[Tuple[StemName]]
|
|
file_format |
FileFormat
|
|
bit_rate |
BitRate | None
|
Output bit rate for lossy formats. The default is chosen by FFmpeg. |
model_config |
|
stem_names
class-attribute
instance-attribute
stem_names: (
Literal["all"] | NonEmptyUnique[Tuple[StemName]]
) = "all"
bit_rate
class-attribute
instance-attribute
bit_rate: BitRate | None = None
Output bit rate for lossy formats. The default is chosen by FFmpeg.
model_config
class-attribute
instance-attribute
model_config = _PYDANTIC_STRICT_CONFIG
ConfigOverrideError
Bases: ValueError
Raised when one or more override strings are syntactically invalid.
parse_override_value
Parse a CLI override value into a Python object.
Shell-like quoting/escaping semantics beyond what your shell and JSON provide are not supported.
Source code in src/splifft/config.py
359 360 361 362 363 364 365 366 367 368 | |
ParsedConfigOverride
parse_config_override
parse_config_override(
override: str,
) -> ParsedConfigOverride
Parse one override entry of the form <dot.path>=<value>. Empty value
is interpreted as an empty string.
Missing = or empty path segments like a..b=1 or .a=1 are considered syntax errors
Source code in src/splifft/config.py
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | |
set_path_value
Set a nested value in-place, creating missing dictionaries as needed.
Source code in src/splifft/config.py
398 399 400 401 402 403 404 405 406 407 408 | |
ConfigOverrides
module-attribute
<dot.path>=<value> form, e.g. inference.batch_size=2
- automatic creation of missing nested dictionaries while applying overrides
- validation is performed after all overrides are applied
Not supported: list index addressing in paths (e.g. a.0.b=1 is treated as string keys)
apply_config_overrides
apply_config_overrides(
mut_config_dict: dict[str, Any],
overrides: ConfigOverrides,
) -> dict[str, Any]
Source code in src/splifft/config.py
421 422 423 424 425 426 427 | |
load_config_dict
Source code in src/splifft/config.py
430 431 432 433 434 435 | |
Config
Bases: BaseModel
Methods:
| Name | Description |
|---|---|
check_derived_stems |
|
check_requested_stems |
|
validate_inference_contract |
|
from_file |
Load config JSON from disk, optionally applying CLI-style overrides. |
Attributes:
| Name | Type | Description |
|---|---|---|
identifier |
str
|
Unique identifier for this configuration |
model_type |
ModelType
|
|
model |
LazyModelConfig
|
|
transform |
FeatureExtractionConfig | None
|
|
audio_io |
AudioIOConfig
|
|
inference |
InferenceConfig
|
|
normalization |
NormalizationConfig
|
|
waveform_chunking |
WaveformChunkingConfig | None
|
|
sequence_chunking |
SequenceChunkingConfig | None
|
|
masking |
MaskingConfig
|
|
derived_stems |
DerivedStemsConfig | None
|
|
output |
OutputConfig
|
|
experimental |
dict[str, Any] | None
|
Any extra experimental configurations outside of the |
model_config |
|
audio_io
class-attribute
instance-attribute
audio_io: AudioIOConfig = Field(
default_factory=AudioIOConfig
)
inference
class-attribute
instance-attribute
inference: InferenceConfig = Field(
default_factory=InferenceConfig
)
normalization
class-attribute
instance-attribute
normalization: NormalizationConfig = Field(
default_factory=NormalizationConfig
)
waveform_chunking
class-attribute
instance-attribute
waveform_chunking: WaveformChunkingConfig | None = None
sequence_chunking
class-attribute
instance-attribute
sequence_chunking: SequenceChunkingConfig | None = None
masking
class-attribute
instance-attribute
masking: MaskingConfig = Field(
default_factory=MaskingConfig
)
output
class-attribute
instance-attribute
output: OutputConfig = Field(default_factory=OutputConfig)
experimental
class-attribute
instance-attribute
Any extra experimental configurations outside of the splifft core.
check_derived_stems
check_derived_stems() -> Self
Source code in src/splifft/config.py
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | |
check_requested_stems
check_requested_stems() -> Self
Source code in src/splifft/config.py
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | |
validate_inference_contract
validate_inference_contract(
model_params: ModelParamsLike,
) -> InferenceArchetype
Source code in src/splifft/config.py
515 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 | |
from_file
classmethod
from_file(
path: StrPath | BytesPath,
*,
overrides: ConfigOverrides = (),
) -> Config
Load config JSON from disk, optionally applying CLI-style overrides.
Source code in src/splifft/config.py
573 574 575 576 577 578 579 580 581 582 583 584 | |
model_config
class-attribute
instance-attribute
model_config = ConfigDict(
arbitrary_types_allowed=True,
strict=True,
extra="forbid",
)
IntoConfig
module-attribute
into_config
into_config(
config: IntoConfig, *, overrides: ConfigOverrides = ()
) -> Config
Convert various config inputs into a validated [Config].
If overrides is non-empty, they are applied before validation.
Caller-owned objects are not mutated.
Source code in src/splifft/config.py
596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | |
Model
Bases: BaseModel
Attributes:
| Name | Type | Description |
|---|---|---|
authors |
list[str]
|
|
purpose |
Literal['separation', 'denoise', 'debleed', 'dereverb', 'decrowd', 'beat_tracking'] | str
|
|
architecture |
Literal['bs_roformer', 'mel_roformer', 'mdx23c', 'scnet', 'beat_this'] | str
|
|
config_id |
str | None
|
The default configuration identifier (filename stem) to use if one is not provided. |
created_at |
str | None
|
ISO8601 date, time is optional (e.g. YYYY-MM-DD) |
output |
NonEmptyUnique[list[Instrument]]
|
|
status |
Literal['tested'] | None
|
|
metrics |
list[Metrics]
|
|
description |
list[Comment]
|
|
resources |
list[Resource]
|
|
model_size |
int | None
|
Model size in bytes, if available. |
purpose
instance-attribute
purpose: (
Literal[
"separation",
"denoise",
"debleed",
"dereverb",
"decrowd",
"beat_tracking",
]
| str
)
architecture
instance-attribute
config_id
class-attribute
instance-attribute
config_id: str | None = None
The default configuration identifier (filename stem) to use if one is not provided.
Files are expected to be in data/config.
If None, the model is not officially supported.
created_at
class-attribute
instance-attribute
created_at: str | None = None
ISO8601 date, time is optional (e.g. YYYY-MM-DD)
output
class-attribute
instance-attribute
output: NonEmptyUnique[list[Instrument]] = Field(
default_factory=list
)
description
class-attribute
instance-attribute
resources
class-attribute
instance-attribute
model_size
class-attribute
instance-attribute
model_size: int | None = None
Model size in bytes, if available.
Metrics
Resource
Comment
Registry
Bases: dict[Identifier, Model]
Methods:
| Name | Description |
|---|---|
__get_pydantic_core_schema__ |
|
from_file |
|
__get_pydantic_core_schema__
classmethod
__get_pydantic_core_schema__(
source_type: Any, handler: GetCoreSchemaHandler
) -> CoreSchema
Source code in src/splifft/config.py
677 678 679 680 681 | |
from_file
classmethod
Source code in src/splifft/config.py
683 684 685 686 687 688 | |