{"record":{"id":"d1d8b343a66f1a2a","repo":"Lightning-AI/pytorch-lightning","slug":"you-requested-to-find-num-devices-devices-but-on","errorCode":null,"errorMessage":"You requested to find {num_devices} devices but only {len(available_devices)} are currently available. The devices {unavailable_devices} are occupied by other processes and can't be used at the moment.","messagePattern":"You requested to find (.+?) devices but only (.+?) are currently available\\. The devices (.+?) are occupied by other processes and can't be used at the moment\\.","errorType":"error_code","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/lightning/fabric/accelerators/cuda.py","lineNumber":130,"sourceCode":"        )\n\n    available_devices = []\n    unavailable_devices = []\n\n    for gpu_idx in visible_devices:\n        try:\n            torch.tensor(0, device=torch.device(\"cuda\", gpu_idx))\n        except RuntimeError:\n            unavailable_devices.append(gpu_idx)\n            continue\n\n        available_devices.append(gpu_idx)\n        if len(available_devices) == num_devices:\n            # exit early if we found the right number of GPUs\n            break\n\n    if num_devices != -1 and len(available_devices) != num_devices:\n        raise RuntimeError(\n            f\"You requested to find {num_devices} devices but only {len(available_devices)} are currently available.\"\n            f\" The devices {unavailable_devices} are occupied by other processes and can't be used at the moment.\"\n        )\n    return available_devices\n\n\ndef _get_all_visible_cuda_devices() -> list[int]:\n    \"\"\"Returns a list of all visible CUDA GPU devices.\n\n    Devices masked by the environment variabale ``CUDA_VISIBLE_DEVICES`` won't be returned here. For example, assume you\n    have 8 physical GPUs. If ``CUDA_VISIBLE_DEVICES=\"1,3,6\"``, then this function will return the list ``[0, 1, 2]``\n    because these are the three visible GPUs after applying the mask ``CUDA_VISIBLE_DEVICES``.\n\n    \"\"\"\n    return list(range(num_cuda_devices()))\n\n\ndef num_cuda_devices() -> int:","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/Lightning-AI/pytorch-lightning/blob/9fed5c27d2a62ff0efd6c3573599921d6ff67c14/src/lightning/fabric/accelerators/cuda.py#L112-L148","documentation":"val_check_interval can be given as a string in strict 'DD:HH:MM:SS' format. _parse_time_interval_seconds splits on ':' and requires exactly 4 parts (days, hours, minutes, seconds). Strings with a different number of colon-separated segments (e.g. 'HH:MM' or '00:00:30') raise this error.","triggerScenarios":"Trainer(val_check_interval='0:0:30') (3 parts); Trainer(val_check_interval='10:00') (2 parts); Trainer(val_check_interval='1:2:3:4:5') (5 parts).","commonSituations":"Naturally writing an HH:MM:SS duration like '00:01:00' (3 segments) instead of DD-prefixed '0:00:01:00'; adapting ISO-8601 durations; passing clock times rather than durations.","solutions":["Format the string as exactly four colon-separated integers: 'DD:HH:MM:SS', e.g. '0:0:30' is invalid, use '0:0:0:30'","Prefer a timedelta or dict: Trainer(val_check_interval=timedelta(minutes=30)) or {'minutes': 30}","Or pass an int/float number of batches / fraction"],"exampleFix":"# before\ntrainer = Trainer(val_check_interval=\"0:0:30\")\n\n# after\ntrainer = Trainer(val_check_interval=\"0:0:0:30\")\n# or\nfrom datetime import timedelta\ntrainer = Trainer(val_check_interval=timedelta(seconds=30))","handlingStrategy":"validation","validationCode":"import re\n\nTIME_RE = re.compile(r\"^\\d+:\\d+:\\d+:\\d+$\")\n\ndef valid_interval_str(s: str) -> bool:\n    return bool(TIME_RE.match(s))","typeGuard":"def is_dd_hh_mm_ss(v) -> bool:\n    if not isinstance(v, str):\n        return False\n    parts = v.split(\":\")\n    return len(parts) == 4 and all(p.isdigit() for p in parts)","tryCatchPattern":null,"preventionTips":["Prefer timedelta or a dict like {'minutes': 30} over string durations","If using strings, always emit four segments: DD:HH:MM:SS","Write the value with f\"{d}:{h:02d}:{m:02d}:{s:02d}\" from ints"],"tags":["pytorch-lightning","trainer","val-check-interval","time-format"],"backgroundTag":"invalid-time-format","analyzedSha":"9fed5c27d2a62ff0efd6c3573599921d6ff67c14","analyzedAt":"2026-08-28T11:52:41.083Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}