Error happens in model after modifying PyMC3 source code

You really should not modify source code for model debugging. For debugging pymc3 model you can have a look at: https://docs.pymc.io/notebooks/howto_debugging.html