wooden-dusk-90720
01/28/2023, 1:08 AMpickle to dill?victorious-lawyer-58417
01/28/2023, 1:16 AMself.my_special_artifact = dill.dumps(my_object)
and on the other side
my_object = dill.loads(self.my_special_artifact)
technically you could do all this is in a custom @dill decorator automatically for all artifactsvictorious-lawyer-58417
01/28/2023, 1:17 AMpickle?victorious-lawyer-58417
01/28/2023, 1:25 AMwooden-dusk-90720
01/28/2023, 1:31 AMvictorious-lawyer-58417
01/28/2023, 1:34 AMvictorious-lawyer-58417
01/28/2023, 1:35 AMdill as shown abovewooden-dusk-90720
01/28/2023, 1:37 AMwooden-dusk-90720
01/28/2023, 1:40 AMwooden-dusk-90720
01/28/2023, 1:41 AMvictorious-lawyer-58417
01/28/2023, 1:43 AM@step function finishesvictorious-lawyer-58417
01/28/2023, 1:43 AMcolossal-jewelry-36870
02/07/2023, 1:30 AM@step
def setup_data_module(self):
from rnn import MyDataModule
self.data_module = MyDataModule(...)
self.next(self.setup_model)
@step
def setup_model(self):
from rnn import LSTMModule, LightningModel
lstm_module = LSTMModule(...)
self.model = LightningModel(lstm_module, ...)
self.next(self.train_model)
@step
def train_model(self):
from pytorch_lightning import Trainer, seed_everything
from pytorch_lightning.loggers import WandbLogger
seed_everything(0, workers=True)
trainer = Trainer(
max_epochs=200,
accelerator="auto",
devices="auto",
deterministic=True,
)
# .tune() and .fit() are called on self.model, then trainer is garbage collected
# storing the trainer object via self.trainer object = trainer doesn't fix the issue
trainer.tune(self.model, datamodule=self.data_module)
trainer.fit(self.model, self.data_module)
self.next(self.end)colossal-jewelry-36870
02/07/2023, 2:29 PMcolossal-jewelry-36870
02/07/2023, 3:40 PMmodel._trainer = None
@step
def train_model(self):
from pytorch_lightning import Trainer
self.trainer_config = dict(...)
trainer = Trainer(**self.trainer_config)
trainer.tune(self.model, datamodule=self.data_module)
trainer.fit(self.model, self.data_module)
self.model._trainer = None
self.next(self.end)