Custom models and core APIs
Use this sub-skill when the user is building a new Asteroid architecture, extending a block, or debugging a low-level API rather than running a recipe or applying a pretrained model.
Typical triggers
- custom
BaseModel or BaseEncoderMaskerDecoder subclasses
asteroid.models.get(...) or register_model(...)
asteroid.masknn, asteroid.dsp, asteroid.complex_nn, or asteroid.utils
- filterbanks, encoders, decoders, mask networks, or normalization layers
- TorchScript / tracing / shape issues
register_norm(...), register_optimizer(...), or prepare_parser_from_dict(...)
What to do first
- Identify the exact block or API family the user wants to extend.
- Decide whether they need:
- a built-in model family
- a reusable block
- a custom serialization contract
- a tracing or shape-debugging pass
- Check the expected input/output shape and the sample-rate contract before editing anything.
Standard workflow
- Read
references/api-reference.md for the model/block/registry surface.
- Read
references/jit-and-tracing.md when TorchScript or torch.jit.trace is involved.
- Read
references/troubleshooting.md when the issue looks like a shape, serialization, or registry mismatch.
- Use
scripts/smoke_building_blocks.py to exercise representative blocks and utilities locally.
Common task families
- new source-separation architectures
- custom encoders/decoders or filterbanks
- mask network experiments
- complex-number-aware layers
- batch or source-dimension shape debugging
- registry-based extension points for activations, norms, optimizers, or models
Built-in model families worth recognizing
The repo exposes ready-to-use model families such as:
- ConvTasNet
- DPRNNTasNet
- DPTNet
- LSTMTasNet
- DeMask
- DCUNet
- DCCRNet
- SuDORMRFNet / SuDORMRFImprovedNet
- FasNetTAC
- XUMX
Those are often the right starting point when the user wants to modify an existing Asteroid model rather than write a fresh stack from scratch.
Troubleshooting reminders
get_model_args() should be able to reconstruct the model cleanly.
BaseModel.from_pretrained(...) round-trips are a good shape/serialization smoke.
BaseEncoderMaskerDecoder expects waveform-like tensors with time last.
- Complex-mask helpers and JIT helpers have their own shape rules.
- If a registry lookup fails, check whether the class was actually registered and whether the name collides with an existing symbol.
Inputs to inspect
- desired input shape and output shape
- time axis, channel axis, and batch axis conventions
- whether the user needs a built-in family, a reusable block, or a registry extension point
- whether tracing or serialization must work in addition to eager execution
Smoke sequence
- Instantiate a tiny built-in model or block.
- Run a forward pass on a tiny tensor.
- Round-trip through
serialize() / from_pretrained() if a model is involved.
- Trace the same block if the request mentions JIT or export.
- Confirm any registry or helper function the user cares about.
What to avoid
- Do not hand-wave shape conventions.
- Do not treat a successful eager forward pass as proof of tracing correctness.
- Do not rely on the original repo checkout in runtime instructions.
- Do not blur custom-model work with recipe training unless the task truly spans both.
Common model-building signals
filterbank, encoder, decoder, or masker usually point to architecture assembly.
complex and beamforming usually point to DSP or complex-valued helpers.
register_* almost always means a registry extension point.
torch.jit or trace means the tracing-safe path should be considered explicitly.
Good questions to ask when unclear
- Is this a new model or a modification of an existing family?
- Which dimensions should be preserved in the output?
- Does the user need a round-trip serialization contract?
- Should the answer focus on eager execution, tracing, or both?
1---2name: custom-models3description: "Build or debug Asteroid custom models, blocks, registries, DSP4 helpers, and tracing behavior."5metadata:6 source: https://skillmd.com/skills/vectorspacelab/custom-models7 disco-role: operating8disable-model-invocation: true9license: MIT10---1112# Custom models and core APIs1314Use this sub-skill when the user is building a new Asteroid architecture, extending a block, or debugging a low-level API rather than running a recipe or applying a pretrained model.1516## Typical triggers1718- custom `BaseModel` or `BaseEncoderMaskerDecoder` subclasses19- `asteroid.models.get(...)` or `register_model(...)`20- `asteroid.masknn`, `asteroid.dsp`, `asteroid.complex_nn`, or `asteroid.utils`21- filterbanks, encoders, decoders, mask networks, or normalization layers22- TorchScript / tracing / shape issues23- `register_norm(...)`, `register_optimizer(...)`, or `prepare_parser_from_dict(...)`2425## What to do first26271. Identify the exact block or API family the user wants to extend.282. Decide whether they need:29 - a built-in model family30 - a reusable block31 - a custom serialization contract32 - a tracing or shape-debugging pass333. Check the expected input/output shape and the sample-rate contract before editing anything.3435## Standard workflow3637- Read `references/api-reference.md` for the model/block/registry surface.38- Read `references/jit-and-tracing.md` when TorchScript or `torch.jit.trace` is involved.39- Read `references/troubleshooting.md` when the issue looks like a shape, serialization, or registry mismatch.40- Use `scripts/smoke_building_blocks.py` to exercise representative blocks and utilities locally.4142## Common task families4344- new source-separation architectures45- custom encoders/decoders or filterbanks46- mask network experiments47- complex-number-aware layers48- batch or source-dimension shape debugging49- registry-based extension points for activations, norms, optimizers, or models5051## Built-in model families worth recognizing5253The repo exposes ready-to-use model families such as:5455- ConvTasNet56- DPRNNTasNet57- DPTNet58- LSTMTasNet59- DeMask60- DCUNet61- DCCRNet62- SuDORMRFNet / SuDORMRFImprovedNet63- FasNetTAC64- XUMX6566Those are often the right starting point when the user wants to modify an existing Asteroid model rather than write a fresh stack from scratch.6768## Troubleshooting reminders6970- `get_model_args()` should be able to reconstruct the model cleanly.71- `BaseModel.from_pretrained(...)` round-trips are a good shape/serialization smoke.72- `BaseEncoderMaskerDecoder` expects waveform-like tensors with time last.73- Complex-mask helpers and JIT helpers have their own shape rules.74- If a registry lookup fails, check whether the class was actually registered and whether the name collides with an existing symbol.7576## Inputs to inspect7778- desired input shape and output shape79- time axis, channel axis, and batch axis conventions80- whether the user needs a built-in family, a reusable block, or a registry extension point81- whether tracing or serialization must work in addition to eager execution8283## Smoke sequence84851. Instantiate a tiny built-in model or block.862. Run a forward pass on a tiny tensor.873. Round-trip through `serialize()` / `from_pretrained()` if a model is involved.884. Trace the same block if the request mentions JIT or export.895. Confirm any registry or helper function the user cares about.9091## What to avoid9293- Do not hand-wave shape conventions.94- Do not treat a successful eager forward pass as proof of tracing correctness.95- Do not rely on the original repo checkout in runtime instructions.96- Do not blur custom-model work with recipe training unless the task truly spans both.9798## Common model-building signals99100- `filterbank`, `encoder`, `decoder`, or `masker` usually point to architecture assembly.101- `complex` and `beamforming` usually point to DSP or complex-valued helpers.102- `register_*` almost always means a registry extension point.103- `torch.jit` or `trace` means the tracing-safe path should be considered explicitly.104105## Good questions to ask when unclear106107- Is this a new model or a modification of an existing family?108- Which dimensions should be preserved in the output?109- Does the user need a round-trip serialization contract?110- Should the answer focus on eager execution, tracing, or both?