model.to(device) for Pytorch Lighting
I currently train my model using GPUs using Pytorch Lightning
trainer = pl.Trainer( gpus=[0,1],  
        distributed_backend='ddp', 
        resume_from_checkpoint=hparams[&quot;resume_from_checkpoint&quot;])
    
    trainer.fit(model, train_dataloader=train_loader, val_dataloaders=val_loader)

Instructions are also clear for how to run test samples with trainer defined to use GPU
trainer.test(test_dataloader=test_dataloader)

and also how to load a model and use it interactively
model = transformer.Model.load_from_checkpoint('/checkpoints/run_300_epoch_217.ckpt')
results = model(in_data,

I use the later to interface with an interactive system via sockets in a docker container.
Is there a proper way to make this Pytorch Lightning model run on GPU?
Lightning instructions say not to use model.to(device), but it appears to work just like Pytorch. Reason for instructions to avoid a side effect?
I started reading about ONNX, but would rather just have an easy way to specify GPU since the interactive setup works perfectly with cpu.

My understanding is that &quot;Remove any .cuda() or to.device() calls&quot; is only for using with the Lightning trainer, because the trainer handles that itself.
If you don't use the trainer, a LightningModule module is basically just a regular PyTorch model with some naming conventions. So using model.to(device) is how to run on GPU.
