Add docs for serialization with NX.serialize#630
Conversation
|
You are obviously welcome to rip this apart but it's a decent start, I might have a go at updating axon_onnx at some point. |
| ## Resuming from a Checkpoint | ||
|
|
||
| To resume training from a saved checkpoint: | ||
|
|
||
| 1. Load the checkpoint with `Axon.Loop.deserialize_state/2` | ||
| 2. Attach it to your loop with `Axon.Loop.from_state/2` | ||
| 3. Run the loop as usual | ||
|
|
||
| ```elixir | ||
| # Load the checkpoint (use the path from your checkpoint files) | ||
| checkpoint_path = "checkpoints/checkpoint_2_50.ckpt" | ||
| serialized = File.read!(checkpoint_path) | ||
| state = Axon.Loop.deserialize_state(serialized) | ||
|
|
||
| # Resume training | ||
| model = | ||
| Axon.input("data") | ||
| |> Axon.dense(8) | ||
| |> Axon.relu() | ||
| |> Axon.dense(1) | ||
|
|
There was a problem hiding this comment.
@seanmor5 I think there's a bit of a dissonance between not having Axon.serialize/deserialize, while checkpoints need their Axon functions. WDYT?
1071994 to
748da9d
Compare
|
Okay thanks for the review @polvalente 🙏🏻 I agree that is does seem weird we have special functions for checkpointing, it would be nice to use Nx.serialize but probably there needs to be some context around the checkpointing I assume? |
|
@aphillipo Agreed. We can go ahead with this PR regardless of the checkpointing issue, and we can revisit that later on. |
bb28eab to
3e8e59b
Compare
|
Okay just fixed formatting issue, should be good to go. Thanks for Axon, I want to play with it more and redo the machine learning course I did in Python in it. It's a good test. |
Uh oh!
There was an error while loading. Please reload this page.