How to …?¶
Change default configs¶
Edit deeptrain.util.configs
.
- Do not edit
deeptrain.util._default_configs
, this will breakDeepTrain
.- Arguments defined in
TrainGenerator.__init__()
will override those specified in the configs (the defaults have no overlaps), so no point in specifying them inconfigs
.
Run examples¶
pip install deeptrain
excludes data by default. To acquire, you can:
- Build data by running scripts in
examples/preprocessing
. Or,- Clone repository and copy-paste
examples/dir/data
into the pip-installeddeeptrain
directory.
With the data you can run the .ipynb
with Jupyter or equivalent .py
scripts in IPython. Note for docs notebook examples,
code isn’t exact, and excludes some formatting irrelevant the examples (e.g. many used os.environ['SCALEFIG'] = '.7'
).
Save train state¶
Using
TrainGenerator.save()
, which saves:
TrainGenerator
attributes- DataGenerator` (both) attributes
- Model state (layer weights, optimizer weights, and/or architecture)
Using
TrainGenerator.checkpoint()
, which saves what.save()
saves, plus:
TrainGenerator
report, made bylogging.generate_report()
- Train & val history figure
3. Saving behavior is configured for objects by respective attributes (defaults in
_default_configs
):
TrainGenerator
:saveskip_list
DataGenerator
(for each):saveskip_list
model
:model_save_kw
,model_save_weights_kw
,optimizer_save_configs
Preprocessor
(of eachDataGenerator
):saveskip_list
Example in Deeper into DeepTrain.
Load train state¶
1. Using
TrainGenerator.load()
, which may load everything saved viaTrainGenerator.save()
andTrainGenerator.checkpoint()
.2. Loading behavior is configured for objects by respective attributes (defaults in
_default_configs
):
TrainGenerator
:loadskip_list
DataGenerator
(for each):loadskip_list
model
:optimizer_load_configs
Preprocessor
(of eachDataGenerator
):loadskip_list
Example in Deeper into DeepTrain.
Use custom train / evaluation function¶
Set fit_fn
/ eval_fn
; see docs in TrainGenerator()
.