how to save and load best model &how to auto select gpu/cpu #13076
Unanswered
lg2578
asked this question in
Lightning Trainer API: Trainer, LightningModule, LightningDataModule
Replies: 2 comments
-
question 2 is solved:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
can you share the stack trace for the first error? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've used keras, pytorch ,and I found pytorch-lightning is amazing.
my questions are:
1.how to save and load best model ?
I've tried code like this:
which get an error :[Errno 21] Is a directory: '/kaggle/working',
why best_model_path not a filename?
2.how to auto select gpu/cpu?
trainer=pl.Trainer( accelerator="gpu",gpus=1,
the above code works when there is a gpu,
but if I turn off the gpu, I need to comment the line
accelerator="gpu",gpus=1,
is there a way like
device = torch.device(" cuda " if torch.cuda. is_available () else " cpu ")
Beta Was this translation helpful? Give feedback.
All reactions