add 'save' and 'load' to the learners and periodic saving to the Runner
-
Review changes -
-
Download -
Patches
-
Plain diff
tl;dr, this MR introduces:
-
learner.save
,learner.load
that saves/loads only the data learner.copy_from(other_learner)
runner.start_periodic_saving(save_kwargs, interval)
This adds saving and loading methods to the learner.
Now each learner has a save
and load
method that can be used to save and load only the data of a learner.
There are two ways of naming the files:
- Using the
fname
argument inlearner.save(fname=...)
- Setting the
fname
attribute, likelearner.fname = 'data/example.p
and thenlearner.save()
The second way must be used when saving the learner
s of a BalancingLearner
.
By default the resulting pickle files are compressed, to turn this off use learner.save(fname=..., compress=False)
learner = Learner2D(...)
learner.save(fname='filename.p')
learner = Learner2D(...)
learner.load(fname='filename.p')
in a BalancingLearner
one can for example
def combo_fname(val):
return '__'.join([f'{k}_{v}' for k, v in val.items()])
combos = adaptive.utils.named_product(a=[1, 2], b=[1])
learners = []
for combo in combos:
l = Learner(partial(f, combo=combo))
l.fname = combo_fname(combo)
learners.append(l)
learner = BalancingLearner(learners)
learner.load(folder='data_folder')
then the next time when you add more parameters to combos
, the data will be loaded for the learners that have the data saved.
This also adds leaner.copy_from(learner2)
to get a new learner with the same data where one (for example) uses different bounds
or loss_per_interval
.
Finally, it adds periodic saving while running with the Runner
.
I've tested this over the last year in adaptive_tools
and seems to work nicely for me.
Still need to
-
test with BalancingLearner -
test with DataSaver -
add doc-strings -
add examples to the notebook
Merge request reports
- version 43a1832d24
- version 4214d31f66
- version 4114d31f66
- version 4014d31f66
- version 3914d31f66
- version 3814d31f66
- version 3714d31f66
- version 3614d31f66
- version 35823655c7
- version 344fb00bca
- version 333e0a3298
- version 32f8de3ec4
- version 31bdf846d2
- version 30b61c3d22
- version 29253aed2e
- version 2846958834
- version 275c84710f
- version 26c18cf9dd
- version 252a441ab3
- version 2453187d56
- version 23db4ee757
- version 221a629076
- version 214744ac0e
- version 204744ac0e
- version 19e96f3801
- version 1864dccb73
- version 17eda476c1
- version 16746b7f25
- version 15ab7480ac
- version 14c28408d9
- version 13a060f4f3
- version 126c700b45
- version 116da04cbc
- version 1021824cab
- version 982634be5
- version 838c039a9
- version 73685dc5f
- version 63721a9ba
- version 569218f37
- version 4d1a2728d
- version 3ce8bf413
- version 28281c20a
- version 162eac290
- master (base)
- latest version89d93acf2 commits,
- version 43a1832d242 commits,
- version 4214d31f662 commits,
- version 4114d31f662 commits,
- version 4014d31f662 commits,
- version 3914d31f662 commits,
- version 3814d31f662 commits,
- version 3714d31f662 commits,
- version 3614d31f662 commits,
- version 35823655c72 commits,
- version 344fb00bca2 commits,
- version 333e0a32982 commits,
- version 32f8de3ec41 commit,
- version 31bdf846d21 commit,
- version 30b61c3d221 commit,
- version 29253aed2e1 commit,
- version 28469588341 commit,
- version 275c84710f1 commit,
- version 26c18cf9dd1 commit,
- version 252a441ab31 commit,
- version 2453187d561 commit,
- version 23db4ee7571 commit,
- version 221a6290761 commit,
- version 214744ac0e1 commit,
- version 204744ac0e1 commit,
- version 19e96f38011 commit,
- version 1864dccb731 commit,
- version 17eda476c11 commit,
- version 16746b7f251 commit,
- version 15ab7480ac1 commit,
- version 14c28408d91 commit,
- version 13a060f4f31 commit,
- version 126c700b451 commit,
- version 116da04cbc1 commit,
- version 1021824cab1 commit,
- version 982634be51 commit,
- version 838c039a91 commit,
- version 73685dc5f1 commit,
- version 63721a9ba1 commit,
- version 569218f371 commit,
- version 4d1a2728d1 commit,
- version 3ce8bf4131 commit,
- version 28281c20a1 commit,
- version 162eac2901 commit,
- Side-by-side
- Inline