Skip to content

Commit 7f16b8f

Browse files
committed
doc: add explanation on save and reload
1 parent 276316b commit 7f16b8f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/quick_start.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,19 @@ In the code snippet above, ``train_loader`` and ``test_loader`` is the PyTorch :
119119

120120
Notice that the ``test_loader`` can also be passed to ``fit``, under the case, the ensemble will be evaluated on the ``test_loader`` after each training epoch.
121121

122+
Save and Reload
123+
---------------
124+
125+
By setting the ``save_model`` to ``True`` in the :meth:`fit` function of the ensemble, model parameters will be automatically saved to the specified path ``save_dir`` (By default, it will be saved in the same folder as the running script). After then, you can use the following code snippet to load the saved ensemble.
126+
127+
.. code-block:: python
128+
129+
from torchensemble.utils import io
130+
131+
io.load(new_ensemble, save_dir) # reload
132+
133+
where :obj:`new_ensemble` is an ensemble instantiated in the same way as the original ensemble.
134+
122135
Example on MNIST
123136
----------------
124137

0 commit comments

Comments
 (0)