Is it ok to define model classes outside of the class that inherits from LightningModule? #8548
Unanswered
EvanZ
asked this question in
Lightning Trainer API: Trainer, LightningModule, LightningDataModule
Replies: 1 comment 1 reply
-
Hey @EvanZ, Did you check
|
Beta Was this translation helpful? Give feedback.
1 reply
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.
-
I'm getting the following runtime error:
Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
I have removed all code that explicitly moves tensors to the gpu or cpu so I'm not sure what is going on. But one question I have that I thought might be related is whether I can define a class that is external to the class that inherits from Lightning Module, such as this:
I've been reading through docs trying to find out if this is allowed. I could imagine if one has a lot of existing code, it could get awkward quite fast to have to contain all of it within the LightningModule class.
Beta Was this translation helpful? Give feedback.
All reactions