Skip to content

LearnerND not loading properly #461

@MrCheatak

Description

@MrCheatak

Consider a problem, where one would like to save an intermediate learning result and continue later. i.e. to increase accuracy.

Saving and loading Learner2D works like charm and I can continue where I left off, but loading a LearnerND throws an error: learner.function cannot be pickled.

Here is a reproducible example for a notebook:

from adaptive import LearnerND, Runner, notebook_extension
notebook_extension()

def sphere(xyz):
    x, y, z = xyz
    return x**2 + y**2 + z**2

fname = r'sphere_learned.pkl'
learner = LearnerND(sphere, bounds=[(-3, 3), (-3, 3), (-3, 3)])
runner = Runner(learner, loss_goal=0.01, ntasks=4)
runner.live_info()
runner.start_periodic_saving(save_kwargs=dict(fname=fname), interval=10)
learner = LearnerND(sphere, bounds=[(-3, 3), (-3, 3), (-3, 3)])
learner.load(fname)
runner = Runner(learner, loss_goal=0.001)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions