It is possible, but it’ll take some work.
- Load your model in Flux v12, and replace each
Diagonal
withFunctors.children(diagonal_layer)
. This will replace each Diagonal layer with a NamedTuple of its parameters, but you can also manually unpack into a different type if you’d like. - Save the modified it back out in the format of your choice, and load it with Flux v13.
- Replace the placeholders made in Step 1 with
Scale
layers.Diagonal
is renamed toScale
in v13, so the layers should work as before. - Bonus: consider saving
Functors.fmapstructure(model)
instead of the model struct directly. This will lose layer types, but it should be far more stable over time because it replaces them with plain old (Named)Tuples. You can load these weights back into a model using Saving & Loading · Flux.