Config
config
Configuration
Classes:
Name | Description |
---|---|
LazyModelConfig |
A lazily validated model configuration. |
StftConfig |
configuration for the short-time fourier transform. |
AudioIOConfig |
|
TorchCompileConfig |
|
InferenceConfig |
|
ChunkingConfig |
|
MaskingConfig |
|
SubtractConfig |
|
SumConfig |
|
OutputConfig |
|
Config |
|
Model |
|
Metrics |
|
Resource |
|
Comment |
|
Registry |
|
Attributes:
Name | Type | Description |
---|---|---|
TorchDtype |
TypeAlias
|
|
Tuple |
|
|
NonEmptyUnique |
|
|
ModelInputStemName |
TypeAlias
|
|
ModelOutputStemName |
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
|
|
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
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
|
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 |
---|---|---|
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
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 |
---|---|---|
normalize_input_audio |
bool
|
|
batch_size |
BatchSize
|
|
force_weights_dtype |
TorchDtype | None
|
|
use_autocast_dtype |
TorchDtype | None
|
|
compile_model |
TorchCompileConfig | None
|
|
apply_tta |
bool
|
|
model_config |
|
force_weights_dtype
class-attribute
instance-attribute
force_weights_dtype: TorchDtype | None = None
model_config
class-attribute
instance-attribute
model_config = _PYDANTIC_STRICT_CONFIG
ChunkingConfig
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
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
Config
Bases: BaseModel
Methods:
Name | Description |
---|---|
check_derived_stems |
|
from_file |
|
Attributes:
Name | Type | Description |
---|---|---|
identifier |
str
|
Unique identifier for this configuration |
model_type |
ModelType
|
|
model |
LazyModelConfig
|
|
stft |
StftConfig | None
|
|
audio_io |
AudioIOConfig
|
|
inference |
InferenceConfig
|
|
chunking |
ChunkingConfig
|
|
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
)
chunking
class-attribute
instance-attribute
chunking: ChunkingConfig = Field(
default_factory=ChunkingConfig
)
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
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 |
|
from_file
classmethod
Source code in src/splifft/config.py
295 296 297 298 |
|
model_config
class-attribute
instance-attribute
model_config = ConfigDict(
arbitrary_types_allowed=True,
strict=True,
extra="forbid",
)
Model
Bases: BaseModel
Attributes:
Name | Type | Description |
---|---|---|
authors |
list[str]
|
|
purpose |
Literal['separation', 'denoise', 'de-reverb', 'enhancement', 'crowd_removal', 'upscaler', 'phase_fixer'] | str
|
|
architecture |
Literal['bs_roformer', 'mel_roformer', 'mdx23c', 'scnet'] | str
|
|
release_date |
str | None
|
YYYY-MM-DD, date is optional |
finetuned_from |
Identifier | None
|
|
output |
list[Instrument]
|
|
status |
Literal['alpha', 'beta', 'stable', 'deprecated'] | None
|
|
metrics |
list[Metrics]
|
|
description |
list[Comment]
|
|
approx_model_size_mb |
float | None
|
|
purpose
instance-attribute
purpose: (
Literal[
"separation",
"denoise",
"de-reverb",
"enhancement",
"crowd_removal",
"upscaler",
"phase_fixer",
]
| str
)
architecture
instance-attribute
release_date
class-attribute
instance-attribute
release_date: str | None = None
YYYY-MM-DD, date is optional
status
class-attribute
instance-attribute
status: (
Literal["alpha", "beta", "stable", "deprecated"] | None
) = None
description
class-attribute
instance-attribute
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
362 363 364 365 366 |
|
from_file
classmethod
from_file(path: StrOrBytesPath) -> Registry
Source code in src/splifft/config.py
368 369 370 371 372 373 |
|