It may be because of my weak program ability in PyMC3 but it looks hard to implement an HMM there.
I rewrote this model by Turing.jl and Stan. It’s so easy to create RVs using for loop with those frameworks.
Now I can implement this model with higher performance. And I think you should try them.