deezer/spleeter · error · ValueError
T is too large considering STFT parameters and chunk duratoi
Error message
T is too large considering STFT parameters and chunk duratoin. Make sure spectrogram time dimension of chunks is larger than T (for instance reducing T or frame_step or increasing chunk duration).
What it means
The same compatibility check also validates the time dimension: `(chunk_duration * sample_rate - frame_length) / frame_step` must be >= T. If the number of STFT frames available in a chunk is smaller than T, a `ValueError` is raised because spectrogram chunks cannot supply T time steps for the model.
Source
Thrown at spleeter/dataset.py:307
self._chunk_duration = chunk_duration
self._audio_adapter = audio_adapter
self._audio_params = audio_params
self._audio_path = audio_path
self._random_seed = random_seed
self.check_parameters_compatibility()
def check_parameters_compatibility(self):
if self._frame_length / 2 + 1 < self._F:
raise ValueError(
"F is too large and must be set to at most frame_length/2+1. "
"Decrease F or increase frame_length to fix."
)
if (
self._chunk_duration * self._sample_rate - self._frame_length
) / self._frame_step < self._T:
raise ValueError(
"T is too large considering STFT parameters and chunk duratoin. "
"Make sure spectrogram time dimension of chunks is larger than T "
"(for instance reducing T or frame_step or increasing chunk duration)."
)
def expand_path(self, sample: Dict) -> Dict:
"""Expands audio paths for the given sample."""
return dict(
sample,
**{
f"{instrument}_path": tf.strings.join(
(self._audio_path, sample[f"{instrument}_path"]), SEPARATOR
)
for instrument in self._instruments
},
)
def filter_error(self, sample: Dict) -> tf.Tensor:View on GitHub (pinned to c8854001ac)
Solutions
- Reduce T to fit: T <= (chunk_duration * sample_rate - frame_length) / frame_step
- Increase chunk_duration so each chunk yields at least T frames
- Reduce frame_step (finer hop) to increase frames per chunk
Example fix
// before SpleeterDataset(chunk_duration=1.0, sample_rate=44100, frame_length=2048, frame_step=1024, T=64, ...) # ~41 frames < T // after SpleeterDataset(chunk_duration=2.0, sample_rate=44100, frame_length=2048, frame_step=1024, T=64, ...) # ~84 frames >= T
Defensive patterns
Strategy: validation
Validate before calling
def validate_stft_t(chunk_duration: float, sample_rate: int, frame_length: int, frame_step: int, T: int):
frames = (chunk_duration * sample_rate - frame_length) / frame_step
if frames < T:
raise ValueError(f'T must be <= {int(frames)} (got T={T}); increase chunk_duration or reduce T/frame_step')
validate_stft_t(chunk_duration=2.0, sample_rate=44100, frame_length=2048, frame_step=1024, T=64) Try / catch
try:
dataset = SpleeterDataset(chunk_duration=chunk_duration, T=T, frame_step=frame_step, ...)
except ValueError as e:
if 'T is too large' in str(e):
T = int((chunk_duration * sample_rate - frame_length) / frame_step)
dataset = SpleeterDataset(chunk_duration=chunk_duration, T=T, frame_step=frame_step, ...)
else:
raise Prevention
- Compute frames-per-chunk whenever chunk_duration, frame_step, or sample_rate changes
- Reduce chunk_duration only together with T; keep them coupled in configs
- Add config-load assertions that mirror check_parameters_compatibility before training
When it happens
Trigger: Constructing `SpleeterDataset(...)` with T larger than the frame count implied by chunk_duration, sample_rate, frame_length, and frame_step — e.g. very small chunk_duration or very large frame_step relative to T.
Common situations: Shortening chunk_duration to save memory without reducing T, changing sample_rate or frame_step in a config inherited from another model, copying hyperparameters between datasets with different chunk lengths.
Related errors
- F is too large and must be set to at most frame_length/2+1.
- {adapter_class_name} is not a valid AudioAdapter class
- No model function {model_type} found
- Unkwnown loss type: {loss_type}
- Invalid mask_extension parameter {extension}
AI-assisted analysis of deezer/spleeter@c8854001ac (2026-08-28).
Data as JSON: /api/errors/15be750f6cc49507.
Report an issue: GitHub.