Config
config
Configuration
Classes:
| Name | Description |
|---|---|
LazyModelConfig |
A lazily validated model configuration. |
StftConfig |
configuration for the short-time fourier transform. |
LogMelConfig |
Configuration for Log-Mel Spectrogram. |
CqtConfig |
Configuration for harmonic CQT feature extraction. |
AudioIOConfig |
|
TorchCompileConfig |
|
InferenceConfig |
|
NormalizationConfig |
|
WaveformChunkingConfig |
|
SequenceChunkingConfig |
|
MaskingConfig |
|
SubtractConfig |
|
SumConfig |
|
OutputConfig |
|
ConfigOverrideError |
Raised when one or more override strings are syntactically invalid. |
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)
]
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 |
tuple[ModelInputStemName | ModelOutputStemName, ...]
|
Returns the model's input and output stem names. |
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
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
stem_names
property
stem_names: tuple[
ModelInputStemName | ModelOutputStemName, ...
]
Returns the model's input and output stem names.
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
CqtConfig
Bases: BaseModel
Configuration for harmonic CQT feature extraction.
This intentionally matches PESTO's HCQT preprocessor defaults so we can share checkpoints without adding SciPy or nnAudio.
Attributes:
| Name | Type | Description |
|---|---|---|
kind |
Literal['cqt']
|
|
hop_size_ms |
float
|
|
harmonics |
NonEmptyUnique[Tuple[Gt0[int]]]
|
|
fmin |
float
|
|
fmax |
float | None
|
|
bins_per_semitone |
Gt0[int]
|
|
n_bins |
Gt0[int]
|
|
center_bins |
bool
|
|
gamma |
float
|
|
center |
bool
|
|
log_epsilon |
float
|
|
model_config |
|
model_config
class-attribute
instance-attribute
model_config = _PYDANTIC_STRICT_CONFIG
FeatureExtractionConfig
module-attribute
FeatureExtractionConfig: TypeAlias = Annotated[
Union[StftConfig, LogMelConfig, CqtConfig],
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
336 337 338 339 340 341 342 343 344 345 | |
parse_config_override
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
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | |
set_path_value
Set a nested value in-place, creating missing dictionaries as needed.
Source code in src/splifft/config.py
370 371 372 373 374 375 376 377 378 379 380 | |
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
393 394 395 396 397 398 399 | |
load_config_dict
Source code in src/splifft/config.py
402 403 404 405 406 407 | |
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
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 459 460 461 462 463 464 465 | |
check_requested_stems
check_requested_stems() -> Self
Source code in src/splifft/config.py
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | |
validate_inference_contract
validate_inference_contract(
model_params: ModelParamsLike,
) -> InferenceArchetype
Source code in src/splifft/config.py
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 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 532 533 534 535 536 537 | |
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
539 540 541 542 543 544 545 546 547 548 549 550 | |
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
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 | |
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
643 644 645 646 647 | |
from_file
classmethod
Source code in src/splifft/config.py
649 650 651 652 653 654 | |