A flexible frequency-band splitter for music source separation, organized around a single separator family that can express BS-style, mel-style, and custom layouts.
Instead of treating BSRoformer and MelBandRoformer as separate architectures, this package treats them as different band-layout configurations of one core design centered on BandSplitRotator.
The codebase is implemented in PyTorch, fully typed (py.typed), and designed for modular reuse so options such as PoPE, custom filter banks, value-residual learning, residual streams, and optional SageAttention acceleration can live on one aligned constructor surface.
If loading a BSRoFormer checkpoint raises a size-mismatch error, check mask_estimator_depth in the configuration.
Some upstream configurations effectively used mask_estimator_depth=1 even when set to 2 because a later subtraction was applied. This package removes that subtraction, so the direct equivalent is:
- set
mask_estimator_depth=1
Updating that value resolves the most common mismatch quickly.
- Forward-looking architecture: A single model family makes it easier to adopt new ideas, such as PoPE or custom band-split definitions, while keeping interfaces aligned with established ecosystems.
- Universal configuration:
BandSplitRotator,BSRoformer, andMelBandRoformershare downstream option names for attention, transformer, mask-estimator, STFT, and loss settings. - Rich tooling and ecosystem: The package provides strong typing (
py.typed), modular APIs, and rich docstrings focusing on usage, literature citations, and migration paths.
Transitioning from other standard implementations is straightforward because most identifiers are exactly the same and the data flow is highly similar.
If you're changing from an existing codebase, you can use the transition modules: simply keep using the BSRoformer and MelBandRoformer namespaces and APIs as a bridge, unify your other classes, and then switch to BandSplitRotator when you're ready.
The key design idea is that the difference between the BS-style front end and the mel-band front end is treated as a band-layout problem, not as a reason to maintain two unrelated model families.
hunterFormsBS.bandSplitRotator.BandSplitRotatoris the primary unified entry point.hunterFormsBS.bs_roformer.BSRoformerandhunterFormsBS.mel_band_roformer.MelBandRoformerserve as transition modules, keeping familiar APIs, upstream names, and defaults.hunterFormsBS.bandSplit.BandSplit,hunterFormsBS.bandSplit.MaskEstimator, andhunterFormsBS.attend.Transformerhold the reusable typed building blocks shared across those entry points.- Attention and transformer options such as
attn_dropout,ff_dropout,flash_attn,sage_attention,scale,num_residual_streams, anduse_value_residual_learningkeep the same identifiers as they move from model constructors into downstream blocks.
At the band level, the model only needs a band-membership map, called mask_filter_bank in the
codebase. You can think of that map as a Boolean matrix
where
- In a non-overlapping BS-style layout, each frequency bin belongs to exactly one band, so
- In an overlapping mel-style layout, some frequency bins belong to more than one band, so
When bands overlap, the reconstructed mask for a frequency bin is averaged across the contributing bands:
That is why this package makes it easy to move between overlapping and non-overlapping bands, and to change how bands are distributed across the frequency axis. The architectural difference lives in the filter bank, not in two separate theories of the model.
| Use this | When | Why |
|---|---|---|
hunterFormsBS.BandSplitRotator |
You are starting new work or want one separator that can cover BS-style, mel-style, and custom band layouts. | This is the unified model entry point. |
hunterFormsBS.bs_roformer.BSRoformer |
You want the familiar non-overlapping BS-style interface or a close comparison with upstream BS-RoFormer code. | The constructor keeps BS-oriented defaults and compatibility fields. |
hunterFormsBS.mel_band_roformer.MelBandRoformer |
You want the familiar mel-band interface or a close comparison with upstream mel-band code. | The constructor keeps mel-oriented defaults and automatic mel-band construction. |
flash_attn=True requests PyTorch scaled-dot-product-attention backends when the active device
supports that path. sage_attention=True asks downstream Attend blocks to call
sageattention.sageattn; install SageAttention manually
before enabling it because hunterFormsBS does not install that package.
BandSplitRotator can choose RoPE or PoPE with use_pope, and the same model family exposes
value-residual and residual-stream controls for deeper attention experiments without changing entry
points.
Most users never need this section. The package already bundles the common lucidrains-style
mel-band split as hunterFormsBS.bandSplit.mask_filter_bank_mel_band_default, and the separator
constructors use that value automatically for sample_rate=44100, stft_n_fft=2048, and
num_bands=60.
If a checkpoint uses a different band layout, pass mask_filter_bank explicitly. For ad-hoc
generation, import a function from hunterFormsBS.make_static_mask_filter_bank in Python and call
the function from a REPL, notebook, or one-off script. There is intentionally no CLI for this
module. librosa is only needed if you call librosa_filters_mel.
filter_bank_non_overlappingprints a static non-overlapping band split fromfreqs_per_bands.librosa_filters_melprints a static mel-band split usinglibrosa.filters.mel.print_static_maskprints the compacttorch.tensor(...)assignment used by the other helpers.
hunterFormsBS.__init__- Direct export:
BandSplitRotator - Purpose: small top-level namespace for the primary separator model.
- Direct export:
hunterFormsBS.bandSplitRotator- Main symbols:
BandSplitRotator - Purpose: unified separator that can build BS-style, mel-style, or custom band layouts from one model family, with downstream attention, transformer, STFT, mask-estimator, and loss options on the constructor.
- Main symbols:
hunterFormsBS.bs_roformer- Main symbols:
BSRoformer - Purpose: familiar non-overlapping BS-style interface with BS-oriented defaults.
- Main symbols:
hunterFormsBS.mel_band_roformer- Main symbols:
MelBandRoformer - Purpose: familiar mel-band interface with automatic mel-band construction.
- Main symbols:
hunterFormsBS.make_static_mask_filter_bank- Main symbols:
filter_bank_non_overlapping,librosa_filters_mel,print_static_mask - Purpose: ad-hoc helper module that prints paste-ready static
mask_filter_bankdefinitions for custom layouts.
- Main symbols:
hunterFormsBS.bandSplit- Main symbols:
BandSplit,MaskEstimator,MLP,lossComputation,DEFAULT_FREQS_PER_BANDS - Purpose: shared band projection, mask-estimation heads, BS-style default partition, and training-loss helper.
- Main symbols:
hunterFormsBS.attend- Main symbols:
Attend,Attention,FeedForward,Transformer - Purpose: shared attention, feedforward, and transformer building blocks with RoPE / PoPE, PyTorch SDPA, optional SageAttention, value-residual, and residual-stream support.
- Main symbols:
hunterFormsBS.theTypes- Main symbols:
ParametersComputeLoss,FlashAttentionConfig,ParametersAttention,ParametersSTFT,ParametersTransformer - Purpose: typed configuration records used across the package.
- Main symbols:
The stable separator path is
raw audio → STFT → band gathering → BandSplit → hierarchical attention → MaskEstimator → mask
followed by overlap-aware mask averaging when needed, complex masking in the STFT domain, and inverse STFT reconstruction back to waveform audio.
The top-level package namespace currently re-exports the primary model that new users most often need:
BandSplitRotator
The compatibility classes are intentionally available from their own modules so that imports can stay explicit during comparisons with upstream repos.
Ad-hoc helpers such as hunterFormsBS.make_static_mask_filter_bank stay as explicit submodule
imports so the main namespace remains small and optional dependencies stay optional.
- BibTeX citation. TeX Source with precise formulas for AI agents.
- eprint: arXiv.1606.08415
- Implementations:
- Common name: GLU (Gated Linear Units)
- BibTeX citation. TeX Source with precise formulas for AI agents.
- Proceedings: proceedings.mlr.press
(^Which is why there are no other papers on this list.)
- BibTeX citation. TeX Source with precise formulas for AI agents.
- Proceedings: proceedings.neurips.cc
- Common name: RMSNorm
- BibTeX citation. TeX Source with precise formulas for AI agents.
- Proceedings: proceedings.neurips.cc
- Implementations:
- bzhangGo/rmsnorm
- hunterhogan/torch_einops_kit.scaleValues.RMSNorm
- Common name: RoPE
- BibTeX citation. TeX Source with precise formulas for AI agents.
- DOI: 10.1016/j.neucom.2023.127063
- Free pre-print: arXiv:2104.09864
- Implementations:
- BibTeX citation. TeX Source with precise formulas for AI agents.
- Proceedings: proceedings.neurips.cc
- BibTeX citation. TeX Source with precise formulas for AI agents.
- Proceedings: proceedings.neurips.cc
- Implementations:
- BibTeX citation. TeX Source with precise formulas for AI agents.
- Proceedings: proceedings.iclr.cc
- Implementation:
SageAttention2: Efficient Attention with Thorough Outlier Smoothing and Per-thread INT4 Quantization
- BibTeX citation. TeX Source with precise formulas for AI agents.
- Proceedings: proceedings.mlr.press
- Implementation:
- BibTeX citation. TeX Source with precise formulas for AI agents.
- Workshop proceedings: OpenReview
- Implementation:
- BibTeX citation.
- Proceedings: ICLR 2022 Conference
- Implementations:
- Common name: BS-RoFormer
- BibTeX citation. TeX Source with precise formulas for AI agents.
- DOI: 10.1109/ICASSP48485.2024.10446843
- Free pre-print: arXiv:2309.02612
- Implementations:
- Common name: MelBand-RoFormer
- BibTeX citation. TeX Source with precise formulas for AI agents.
- Proceedings: 10.5281/zenodo.14877371
- Implementations:
- Common name: ResFormer
- BibTeX citation. TeX Source with precise formulas for AI agents.
- Proceedings: 10.18653/v1/2025.acl-long.1375
- Implementations:
- Common name: PoPE
- BibTeX citation. TeX Source with precise formulas for AI agents.
- eprint: arXiv.2509.10534
- Implementations:
