Local Max-Entropy and Free Energy Principles, Belief Diffusions and their Singularities