Serialised MCState (sometimes) does not produce correct results? #1985
-
Hi! In my optimisation process, I have created a callback which checks the current loss and if it under a certain threshold, it exports the serialised MCState, so something like
where I have manager to pass the variational state somehow to the callback and then use the the serialisation from here. Later, to load the state, I create the same network, same sampler, etc. and then load the state by using this function. However, when I compute the expectation value of the same operator I was minimising, I do not get the same result that I had when I saved it. This is not always the case, but it happens so often that it might as well be and I really start to question my sanity now... Is there any reason for this to be the case? Am I doing something incorrectly? I am not sure if it is a serialisation issue or is it some issue in the order of doing things (e.g. is the callback exporting the state after the parameter update) or is it some conceptual thing (e.g. I would never get the same cost because the minimisation isnt completed yet). My goal is to basically export a "frozen state" of the current entire process that enables me to produce the same cost and look at the same variational state at the time that cost was produced. Any help would be appreciated! P.S. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I am closing this discussion as I have discovered the error which was on my part, it was an issue of the state of the variational state being passed to the callback... |
Beta Was this translation helpful? Give feedback.
Also notice that there is a logger that does exactly that https://netket.readthedocs.io/en/v3.6/api/_generated/driver/netket.logging.StateLog.html#netket.logging.StateLog