How to load BSON file of the model build with Flux@0.12.10 to use with Flux@0.13? Flux.Diagonal deprecated problem

It is possible, but it’ll take some work.

  1. Load your model in Flux v12, and replace each Diagonal with Functors.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.
  2. Save the modified it back out in the format of your choice, and load it with Flux v13.
  3. Replace the placeholders made in Step 1 with Scale layers. Diagonal is renamed to Scale in v13, so the layers should work as before.
  4. 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.