Solved by mr_easy in post #2 
              
              
                I got this workaround. I don’t know what the problem is and how to correctly resolve it. But just posting it. 
Since the weights are already there in the loaded_model, so I copied those weights into another model that I created using same arguments as in the training time: 
model = charGen(n_letters…