Pretrained inference
Use this sub-skill when the user wants to apply an existing Asteroid model rather than build or train one.
Typical triggers
asteroid-inferBaseModel.from_pretrained(...)model.separate(...),separate(...),numpy_separate(...),torch_separate(...), orfile_separate(...)- Torch Hub, Hugging Face IDs, Zenodo URLs, or local
model.pthfiles available_models()/show_available_models()- long-file chunking with
LambdaOverlapAdd
What to do first
- Identify the checkpoint source:
- local serialized dict or
model.pth - public URL
- Hugging Face model ID
- Torch Hub usage
- Decide whether the user wants:
- a tensor/numpy result
- files written next to the inputs
- a temporary smoke check only
- Choose the device explicitly when ambiguity matters.
asteroid-inferdefaults to CUDA if available, otherwise CPU.- Long file inference can optionally be wrapped in
LambdaOverlapAdd.
Standard workflow
- Read
references/pretrained-models.mdfor the model-loading matrix and cache behavior. - Read
references/cli-reference.mdfor the public CLI flags and file-handling rules. - Read
references/troubleshooting.mdwhen the model source, file type, or device choice looks suspicious. - Use
scripts/smoke_pretrained_inference.pyfor a tiny local round-trip on tensors and files.
Common path choices
- Local checkpoint: call
BaseModel.from_pretrained(path_or_conf). - Public model name: resolve through
BaseModel.from_pretrained(...)or Torch Hub. - Audio files: call
model.separate(path)or the CLI with--files. - Long files: wrap the model in
LambdaOverlapAddbefore separating.
Output expectations
- Tensor or numpy inputs return separated arrays with a source dimension.
- File inputs create
*_estN.wavoutputs unless an output directory is set. - The CLI should print or save separated waveforms without requiring the original repository checkout.
Troubleshooting reminders
requestsmissing usually means the bundled runtime bootstrap was skipped; runpython scripts/install_runtime.pyfrom the skill output.librosamissing usually meansasteroid.dataor audio-visual helpers were imported without the optional audio dependency.- Sample-rate mismatches usually need
--resampleor a model whosesample_ratematches the input. - Existing output files need
--force-overwrite.
Inputs to inspect
- checkpoint source and format
- sample rate and channel count
- whether the request is tensor, numpy, file, or folder based
- whether the user wants a one-off smoke or a reusable separation recipe
Smoke sequence
- Load or serialize a tiny model.
- Round-trip it through
from_pretrained(...). - Run a tiny tensor separation call.
- Run a tiny file separation call if files are involved.
- Add overlap-add only when the request mentions long files or chunking.
What to avoid
- Do not tell the user to rely on the original checkout at runtime.
- Do not imply that a remote model download is guaranteed to work offline.
- Do not hide a sample-rate mismatch behind a vague error message.
- Do not use model-sharing guidance unless the user is actually preparing an upload.
Output shapes to remember
- tensor and numpy paths keep a source dimension in the output
- file paths write WAV files next to the input or in the requested output directory
- overlap-add should preserve the source dimension while chunking long signals
Good questions to ask when unclear
- Is the checkpoint local or remote?
- Do you want files or in-memory arrays?
- Should the output be forced onto CPU or a specific CUDA device?
- Is this a short clip or a long-file inference problem?