{"record":{"id":"6c27ea4c75a96c31","repo":"huggingface/pytorch-image-models","slug":"batch-sizes-must-contain-at-least-one-value","errorCode":null,"errorMessage":"batch_sizes must contain at least one value.","messagePattern":"batch_sizes must contain at least one value\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"timm/data/scheduled_sampler.py","lineNumber":65,"sourceCode":"            self,\n            sampler: Sampler,\n            batch_sizes: Sequence[int],\n            choice_weights: Optional[Sequence[float]] = None,\n            seed: int = 0,\n            drop_last: bool = True,\n            shuffle_schedule: bool = True,\n            num_batches: Optional[int] = None,\n            choice_schedule: str = 'constant',\n            schedule_epochs: Optional[int] = None,\n            schedule_spread: float = 0.65,\n            schedule_random_mix: float = 0.1,\n    ) -> None:\n        if not hasattr(sampler, '__len__'):\n            raise TypeError('ScheduledBatchSampler requires a sampler with a length.')\n        if len(sampler) <= 0:\n            raise ValueError('ScheduledBatchSampler requires a non-empty sampler.')\n        if not batch_sizes:\n            raise ValueError('batch_sizes must contain at least one value.')\n        if any(int(batch_size) != batch_size or batch_size <= 0 for batch_size in batch_sizes):\n            raise ValueError('All scheduled batch sizes must be positive integers.')\n        if num_batches is not None and (int(num_batches) != num_batches or num_batches <= 0):\n            raise ValueError('num_batches must be a positive integer when specified.')\n        if choice_schedule not in ('constant', 'progressive'):\n            raise ValueError(\"choice_schedule must be 'constant' or 'progressive'.\")\n        if choice_schedule == 'progressive':\n            if len(batch_sizes) < 2:\n                raise ValueError('A progressive schedule requires at least two choices.')\n            if schedule_epochs is None or int(schedule_epochs) != schedule_epochs or schedule_epochs <= 0:\n                raise ValueError('schedule_epochs must be a positive integer for a progressive schedule.')\n            if schedule_spread < 0:\n                raise ValueError('schedule_spread must be non-negative.')\n            if not 0 <= schedule_random_mix <= 1:\n                raise ValueError('schedule_random_mix must be between 0 and 1.')\n\n        self.sampler = sampler\n        self.batch_sizes = tuple(int(batch_size) for batch_size in batch_sizes)","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/huggingface/pytorch-image-models/blob/9a5261e31b3b5128526eb2658333b4c0a54464ae/timm/data/scheduled_sampler.py#L47-L83","documentation":"batch_sizes (the list of batch sizes the scheduler alternates/schedules among) was empty, leaving the sampler with no valid batch size to emit; caught during constructor validation.","triggerScenarios":"Calling ScheduledBatchSampler(sampler, batch_sizes=[]) or batch_sizes=None after a config layer turned a missing value into an empty list.","commonSituations":"YAML/JSON config where the batch_sizes key is empty or omitted and defaults to []; programmatically generated lists that end up empty for small models.","solutions":["Provide at least one positive batch size, e.g. batch_sizes=[256].","Fix the config loader to default to a sensible single-size list like [batch_size]."],"exampleFix":"# before\nScheduledBatchSampler(sampler, batch_sizes=[])\n\n# after\nScheduledBatchSampler(sampler, batch_sizes=[256])","handlingStrategy":"validation","validationCode":"batch_sizes = batch_sizes or [config['batch_size']]\nassert len(batch_sizes) >= 1","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default empty config lists to a sensible single-value list.","Schema-validate training configs before constructing samplers."],"tags":["timm","sampler","batch-size","config"],"backgroundTag":"empty-configuration-list","analyzedSha":"9a5261e31b3b5128526eb2658333b4c0a54464ae","analyzedAt":"2026-08-27T02:34:25.417Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}