Open scintiller opened 3 years ago
Yes. You can load a checkpoint at any time by solver.load("model_3epoch.pkl")
. And then do whatever you want, like further training or inference.
Notice that currently there are a little performance difference between a model trained from checkpoint (e.g. 3 epochs + 3 epochs) and a model trained from scratch (e.g. 6 epochs).
Yes. You can load a checkpoint at any time by
solver.load("model_3epoch.pkl")
. And then do whatever you want, like further training or inference.Notice that currently there are a little performance difference between a model trained from checkpoint (e.g. 3 epochs + 3 epochs) and a model trained from scratch (e.g. 6 epochs).
Can you provide the complete load code, and how to define model and task
Hi Followed by the question of lonngxiang, I also looking for example code to predict new data using trained model. Currently in order to load the training model I need to at least prepare train_set
as following:
model = models.GIN(input_dim=67,
hidden_dims=[261, 251],
short_cut=True, batch_norm=True, concat_hidden=True) # input_dim=dataset.node_feature_dim
task = tasks.PropertyPrediction(
model, task=['degradable'],
criterion="bce", metric=("auprc", "auroc"),
) # task=dataset.tasks
optimizer = torch.optim.Adam(task.parameters(), lr=1e-3)
solver = core.Engine(
task, train_set=train_set, valid_set=None, test_set=None, optimizer=optimizer,
gpus=[0], batch_size=1024, log_interval=1000
)
solver.load("trianed_model.pkl")
before I made predictions using:
preds = F.sigmoid(task.predict(samples))
targets = task.target(samples)
is it possible that not prepare the train_set
to make predictions?
btw why predictions does not need solver? I guess solver and task are linked, sorry this may be a noob question
For example, after train a model for 3 epochs and save it as
model_3epoch.pkl
, how to loadmodel_3epoch.pkl
and train it for more epochs?Besides that, if we train
model_3epoch.pkl
with the training dataset, can we load it and train it with the test dataset then?The question was asked here at first.