-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Labels
accelerator: cudaCompute Unified Device Architecture GPUCompute Unified Device Architecture GPUbugSomething isn't workingSomething isn't workinghelp wantedOpen to be worked onOpen to be worked on
Milestone
Description
π Bug
To Reproduce
import os
from pytorch_lightning import Trainer
from pytorch_lightning.demos.boring_classes import BoringModel
class BugReportModel(BoringModel):
def setup(self, stage=None):
# current workaround
assert self.trainer.strategy.root_device.type == "cuda"
# error! it is on cpu
assert self.device.type == "cuda"
def run():
model = BugReportModel()
trainer = Trainer(
default_root_dir=os.getcwd(),
fast_dev_run=True,
accelerator="gpu",
devices=1,
)
trainer.fit(model)
if __name__ == "__main__":
run()
Expected behavior
lightning_module.device
and strategy.device
point to the same device
Additional context
Reported in Slack by Joshua Chia
cc @tchaton @rohitgr7 @justusschock @kaushikb11 @awaelchli @akihironitta
saifullah3396, jetd1, apoorv-rai and heitorrapela
Metadata
Metadata
Assignees
Labels
accelerator: cudaCompute Unified Device Architecture GPUCompute Unified Device Architecture GPUbugSomething isn't workingSomething isn't workinghelp wantedOpen to be worked onOpen to be worked on