Indeed, it works perfectly when you restore the objects, here the encoder, decoder and optimiser, in the same execution context, but execute my code separately as if you wanted to load the objects in a new execution, without having executed the code in the tutorial, and you will normally have the same error.