2020-02-11 04:55:22 +00:00
|
|
|
Test set
|
2020-05-05 02:16:54 +00:00
|
|
|
========
|
2020-02-11 04:55:22 +00:00
|
|
|
Lightning forces the user to run the test set separately to make sure it isn't evaluated by mistake
|
|
|
|
|
|
|
|
|
|
|
|
Test after fit
|
2020-05-05 02:16:54 +00:00
|
|
|
--------------
|
2020-02-11 04:55:22 +00:00
|
|
|
To run the test set after training completes, use this method
|
|
|
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
# run full training
|
|
|
|
trainer.fit(model)
|
|
|
|
|
|
|
|
# run test set
|
|
|
|
trainer.test()
|
|
|
|
|
|
|
|
Test pre-trained model
|
2020-02-11 12:41:15 +00:00
|
|
|
----------------------
|
2020-05-05 02:16:54 +00:00
|
|
|
To run the test set on a pre-trained model, use this method.
|
2020-02-11 04:55:22 +00:00
|
|
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
model = MyLightningModule.load_from_metrics(
|
|
|
|
weights_path='/path/to/pytorch_checkpoint.ckpt',
|
|
|
|
tags_csv='/path/to/test_tube/experiment/version/meta_tags.csv',
|
|
|
|
on_gpu=True,
|
|
|
|
map_location=None
|
|
|
|
)
|
|
|
|
|
|
|
|
# init trainer with whatever options
|
|
|
|
trainer = Trainer(...)
|
|
|
|
|
|
|
|
# test (pass in the model)
|
|
|
|
trainer.test(model)
|
|
|
|
|
|
|
|
In this case, the options you pass to trainer will be used when
|
2020-05-05 02:16:54 +00:00
|
|
|
running the test set (ie: 16-bit, dp, ddp, etc...)
|