Recommended approach to save and load optimiser state #830
-
Hi, I was just wondering what the recommended approach is to save and load optimiser state? I see for models (i.e. those that inherit from e.g. if I initialise I started hacking around and implemented something of the form: def load_optimiser(optimiser: optim.Optimizer, path: Path) -> None:
params = list(mx.load(str(path)).items())
optimiser.state = tree_unflatten(params) However, I figured I'd ask if there's an existing approach built into the library that I just can't find before I go any further down this route. Many thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
There is in fact no built-in saving/loading for optimizers, but I think what you implemented is a perfectly good way to do it. |
Beta Was this translation helpful? Give feedback.
There is in fact no built-in saving/loading for optimizers, but I think what you implemented is a perfectly good way to do it.