{"record":{"id":"edf3c0f4ad6fc368","repo":"Lightning-AI/pytorch-lightning","slug":"name-must-be-a-str-found-name","errorCode":null,"errorMessage":"`name` must be a str, found {name}","messagePattern":"`name` must be a str, found (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"src/lightning/fabric/accelerators/registry.py","lineNumber":66,"sourceCode":"        self,\n        name: str,\n        accelerator: Optional[Callable] = None,\n        description: str = \"\",\n        override: bool = False,\n        **init_params: Any,\n    ) -> Callable:\n        \"\"\"Registers a accelerator mapped to a name and with required metadata.\n\n        Args:\n            name : the name that identifies a accelerator, e.g. \"gpu\"\n            accelerator : accelerator class\n            description : accelerator description\n            override : overrides the registered accelerator, if True\n            init_params: parameters to initialize the accelerator\n\n        \"\"\"\n        if not (name is None or isinstance(name, str)):\n            raise TypeError(f\"`name` must be a str, found {name}\")\n\n        if name in self and not override:\n            raise MisconfigurationException(f\"'{name}' is already present in the registry. HINT: Use `override=True`.\")\n\n        data: dict[str, Any] = {}\n\n        data[\"description\"] = description\n        data[\"init_params\"] = init_params\n\n        def do_register(accelerator: Callable) -> Callable:\n            data[\"accelerator\"] = accelerator\n            data[\"accelerator_name\"] = name\n            self[name] = data\n            return accelerator\n\n        if accelerator is not None:\n            return do_register(accelerator)\n","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/Lightning-AI/pytorch-lightning/blob/9fed5c27d2a62ff0efd6c3573599921d6ff67c14/src/lightning/fabric/accelerators/registry.py#L48-L84","documentation":"Trainer(barebones=True) opts out of every feature that can slow down raw training speed, including checkpointing. If enable_checkpointing is truthy (True, a string path, or a CheckpointInterval-like value) in barebones mode, __init__ raises ValueError; otherwise it forces enable_checkpointing=False.","triggerScenarios":"Trainer(barebones=True, enable_checkpointing=True); passing a checkpoint dir string like Trainer(barebones=True, enable_checkpointing='./ckpt'); any truthy enable_checkpointing value combined with barebones=True.","commonSituations":"Sharing a single Trainer config dict across benchmark (barebones) and full runs and forgetting to also disable checkpointing; benchmark scripts copied from normal training scripts; performance regression testing harnesses.","solutions":["Remove enable_checkpointing (or set it False/None) when using barebones=True","If you need checkpoints, drop barebones=True and selectively disable logger/progress bar instead","Use a config branch: {**base, 'barebones': True, 'enable_checkpointing': False}"],"exampleFix":"# before\ntrainer = Trainer(barebones=True, enable_checkpointing=True)\n\n# after\ntrainer = Trainer(barebones=True, enable_checkpointing=False)\n# or, if checkpoints are required\ntrainer = Trainer(enable_checkpointing=True)","handlingStrategy":"validation","validationCode":"def barebones_kwargs(barebones: bool, **kwargs):\n    if barebones:\n        for opt in (\"enable_checkpointing\", \"logger\", \"enable_progress_bar\", \"log_every_n_steps\"):\n            if kwargs.get(opt):\n                raise ValueError(f\"barebones=True forbids {opt}\")\n        kwargs.update(enable_checkpointing=False, logger=False,\n                      enable_progress_bar=False, log_every_n_steps=0)\n    return kwargs","typeGuard":"def is_barebones_compatible(barebones: bool, kwargs: dict) -> bool:\n    if not barebones:\n        return True\n    return not any(kwargs.get(o) for o in (\"enable_checkpointing\", \"logger\", \"enable_progress_bar\"))","tryCatchPattern":null,"preventionTips":["Keep a dedicated benchmark Trainer config that sets all speed-impacting opts off","Don't share kwargs dicts between barebones and normal runs","Remember barebones disables checkpointing, logger, progress bar, and log_every_n_steps"],"tags":["pytorch-lightning","trainer","barebones","checkpointing"],"backgroundTag":"conflicting-options","analyzedSha":"9fed5c27d2a62ff0efd6c3573599921d6ff67c14","analyzedAt":"2026-08-28T11:52:41.083Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}