LION.optimizers.training_record¶
The record of how a model was trained.
A solver writes it, as the training of every model file it saves (final,
best validation, checkpoints), next to the record of the training data
(dataset_params, LION.data_loaders.data_record):
solver: the solver’s spec, without the model (the file’smodel), the optimizer (below) and where it ran (device,verbose,save_folder); itssolver_paramsinclude values it computed (e.g. E2I’snoise_std);optimizer: the optimizer’s class and hyperparameters;parameter_groups: its parameter groups (each one’s parameters, by name in the model, and settings, with the learning rate it started with), or None for one group of all the parameters with those hyperparameters;scheduler: the learning-rate scheduler’s class and arguments, or None (when it steps,scheduler_step, is the solver’s);seed: the training seed (None: unseeded), andinitial_weights_sha256, a hash of the weights training started from;initial_weights: how those can be made again (LIONmodel.instantiate( file, initial_weights=True)):{"from": "random_state"}(the model made again from the random state saved with it),{"from": "file", "file": ...}(saved next to the results), or{"from": None}; for weights that weren’t made from the random state,origin: the model file they were loaded from and its weights hash (a fine-tuned model’s original), or None if they didn’t come from a LION model file;train: how the training data were fed (batch_size,shuffle,drop_last); the data themselves are the file’sdataset_params;validation: its data record, how they were fed,every(epochs), the validationfunction, and thereconstructorit reconstructs with (its spec: operator and parameters), if one was given;epochs:asked(train(n)) anddone;weights: which weights the file holds:kind(“final”, “best_validation”, “checkpoint”), after whichepoch(counted from 1), and for the best validation itsvalue;history: the training loss, validation value (nullwhen not validated) and learning rate (a list, one per parameter group, when there are several) of each epoch done.
What can’t be written as a spec (a lambda loss) is named, with a warning.
A record is a LIONParameter (record.epochs.done) whose specs
(record.solver, record.optimizer) stay dicts; it is saved as plain JSON
and read back as a LIONParameter, like the data record.
Functions
|
The first |
|
A training record, as a |
|
How a |
|
The training record in |
|
A hash of a model's weights (names and values, in order). |
- LION.optimizers.training_record.history(values, done)[source]¶
The first
donevalues as JSON numbers (Nonefor NaN).
- LION.optimizers.training_record.is_training_record(value)[source]¶
A training record, as a
LIONParameteror as the dict read from JSON.
- LION.optimizers.training_record.loader_settings(loader)[source]¶
How a
DataLoaderfeeds its data:batch_size,shuffle,drop_last. A sampler other than torch’s sequential and random ones is named insampler.