{"record":{"id":"de0cedae50795a6d","repo":"Lightning-AI/pytorch-lightning","slug":"f-trainer-barebones-true-profiler-profiler-r","errorCode":null,"errorMessage":"f\"`Trainer(barebones=True, profiler={profiler!r})` was passed.\" \" Profiling can impact raw speed so it is disabled in barebones mode.\"","messagePattern":"f\"`Trainer\\(barebones=True, profiler=(.+?)\\)` was passed\\.\" \" Profiling can impact raw speed so it is disabled in barebones mode\\.\"","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/lightning/pytorch/trainer/trainer.py","lineNumber":385,"sourceCode":"            if num_sanity_val_steps is not None and num_sanity_val_steps != 0:\n                raise ValueError(\n                    f\"`Trainer(barebones=True, num_sanity_val_steps={num_sanity_val_steps!r})` was passed.\"\n                    \" Sanity checking can impact raw speed so it is disabled in barebones mode.\"\n                )\n            num_sanity_val_steps = 0\n            # opt-ins\n            if fast_dev_run is not False and fast_dev_run != 0:\n                raise ValueError(\n                    f\"`Trainer(barebones=True, fast_dev_run={fast_dev_run!r})` was passed.\"\n                    \" Development run is not meant for raw speed evaluation so it is disabled in barebones mode.\"\n                )\n            if detect_anomaly:\n                raise ValueError(\n                    f\"`Trainer(barebones=True, detect_anomaly={detect_anomaly!r})` was passed.\"\n                    \" Anomaly detection can impact raw speed so it is disabled in barebones mode.\"\n                )\n            if profiler is not None:\n                raise ValueError(\n                    f\"`Trainer(barebones=True, profiler={profiler!r})` was passed.\"\n                    \" Profiling can impact raw speed so it is disabled in barebones mode.\"\n                )\n            deactivated = (\n                \" - Checkpointing: `Trainer(enable_checkpointing=True)`\",\n                \" - Progress bar: `Trainer(enable_progress_bar=True)`\",\n                \" - Model summary: `Trainer(enable_model_summary=True)`\",\n                \" - Logging: `Trainer(logger=True)`, `Trainer(log_every_n_steps>0)`,\"\n                \" `LightningModule.log(...)`, `LightningModule.log_dict(...)`\",\n                \" - Sanity checking: `Trainer(num_sanity_val_steps>0)`\",\n                \" - Development run: `Trainer(fast_dev_run=True)`\",\n                \" - Anomaly detection: `Trainer(detect_anomaly=True)`\",\n                \" - Profiling: `Trainer(profiler=...)`\",\n            )\n            rank_zero_info(\n                \"You are running in `Trainer(barebones=True)` mode. All features that may impact raw speed have been\"\n                \" disabled to facilitate analyzing the Trainer overhead. Specifically, the following features are\"\n                f\" deactivated:{os.linesep}{os.linesep.join(deactivated)}\"","sourceCodeStart":367,"sourceCodeEnd":403,"githubUrl":"https://github.com/Lightning-AI/pytorch-lightning/blob/9fed5c27d2a62ff0efd6c3573599921d6ff67c14/src/lightning/pytorch/trainer/trainer.py#L367-L403","documentation":"Trainer was created with barebones=True while a profiler was passed. Profiling instruments the training loop and impacts raw speed, so barebones mode rejects any non-None profiler.","triggerScenarios":"Trainer(barebones=True, profiler=PyTorchProfiler(...)) or profiler=\"advanced\" etc.","commonSituations":"Attempting to benchmark and profile in the same run by combining barebones=True with a profiler, which is contradictory.","solutions":["Remove the profiler argument when using barebones=True","Pass profiler=None","Run two separate Trainers: one barebones for speed, one with a profiler for profiling"],"exampleFix":"// before\ntrainer = Trainer(barebones=True, profiler=PyTorchProfiler(dirpath=\"prof\"))\n// after\ntrainer = Trainer(barebones=True)  # profile in a separate run without barebones","handlingStrategy":"validation","validationCode":"if cfg.get(\"barebones\") and cfg.get(\"profiler\") is not None:\n    cfg[\"profiler\"] = None\ntrainer = Trainer(**cfg)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Profile and benchmark in separate Trainer instances/runs","Wrap Trainer construction from a config dict so incompatible keys can be sanitized centrally"],"tags":["trainer","barebones","profiler","misconfiguration","pytorch-lightning"],"backgroundTag":"invalid-argument-combination","analyzedSha":"9fed5c27d2a62ff0efd6c3573599921d6ff67c14","analyzedAt":"2026-08-28T11:52:41.083Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}