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/datainto the pip-installeddeeptraindirectory.
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:
TrainGeneratorattributes- DataGenerator` (both) attributes
- Model state (layer weights, optimizer weights, and/or architecture)
Using
TrainGenerator.checkpoint(), which saves what.save()saves, plus:
TrainGeneratorreport, made bylogging.generate_report()- Train & val history figure
3. Saving behavior is configured for objects by respective attributes (defaults in
_default_configs):
TrainGenerator:saveskip_listDataGenerator(for each):saveskip_listmodel:model_save_kw,model_save_weights_kw,optimizer_save_configsPreprocessor(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_listDataGenerator(for each):loadskip_listmodel:optimizer_load_configsPreprocessor(of eachDataGenerator):loadskip_list
Example in Deeper into DeepTrain.
Use custom train / evaluation function¶
Set fit_fn / eval_fn; see docs in TrainGenerator().