{"record":{"id":"15be750f6cc49507","repo":"deezer/spleeter","slug":"t-is-too-large-considering-stft-parameters-and-chu","errorCode":null,"errorMessage":"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).","messagePattern":"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\\)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"spleeter/dataset.py","lineNumber":307,"sourceCode":"        self._chunk_duration = chunk_duration\n        self._audio_adapter = audio_adapter\n        self._audio_params = audio_params\n        self._audio_path = audio_path\n        self._random_seed = random_seed\n\n        self.check_parameters_compatibility()\n\n    def check_parameters_compatibility(self):\n        if self._frame_length / 2 + 1 < self._F:\n            raise ValueError(\n                \"F is too large and must be set to at most frame_length/2+1. \"\n                \"Decrease F or increase frame_length to fix.\"\n            )\n\n        if (\n            self._chunk_duration * self._sample_rate - self._frame_length\n        ) / self._frame_step < self._T:\n            raise ValueError(\n                \"T is too large considering STFT parameters and chunk duratoin. \"\n                \"Make sure spectrogram time dimension of chunks is larger than T \"\n                \"(for instance reducing T or frame_step or increasing chunk duration).\"\n            )\n\n    def expand_path(self, sample: Dict) -> Dict:\n        \"\"\"Expands audio paths for the given sample.\"\"\"\n        return dict(\n            sample,\n            **{\n                f\"{instrument}_path\": tf.strings.join(\n                    (self._audio_path, sample[f\"{instrument}_path\"]), SEPARATOR\n                )\n                for instrument in self._instruments\n            },\n        )\n\n    def filter_error(self, sample: Dict) -> tf.Tensor:","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/deezer/spleeter/blob/c8854001ac8acad34a9bc2bd15f28475541828b1/spleeter/dataset.py#L289-L325","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nSpleeterDataset(chunk_duration=1.0, sample_rate=44100, frame_length=2048, frame_step=1024, T=64, ...)  # ~41 frames < T\n// after\nSpleeterDataset(chunk_duration=2.0, sample_rate=44100, frame_length=2048, frame_step=1024, T=64, ...)  # ~84 frames >= T","handlingStrategy":"validation","validationCode":"def validate_stft_t(chunk_duration: float, sample_rate: int, frame_length: int, frame_step: int, T: int):\n    frames = (chunk_duration * sample_rate - frame_length) / frame_step\n    if frames < T:\n        raise ValueError(f'T must be <= {int(frames)} (got T={T}); increase chunk_duration or reduce T/frame_step')\nvalidate_stft_t(chunk_duration=2.0, sample_rate=44100, frame_length=2048, frame_step=1024, T=64)","typeGuard":null,"tryCatchPattern":"try:\n    dataset = SpleeterDataset(chunk_duration=chunk_duration, T=T, frame_step=frame_step, ...)\nexcept ValueError as e:\n    if 'T is too large' in str(e):\n        T = int((chunk_duration * sample_rate - frame_length) / frame_step)\n        dataset = SpleeterDataset(chunk_duration=chunk_duration, T=T, frame_step=frame_step, ...)\n    else:\n        raise","preventionTips":["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"],"tags":["configuration","hyperparameters","stft","value-error"],"backgroundTag":"invalid-stft-parameters","analyzedSha":"c8854001ac8acad34a9bc2bd15f28475541828b1","analyzedAt":"2026-08-28T21:38:40.142Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}