BPE(Byte pair encoding)

Recently tried wrapping my head around the BPE algorithm, in the process learnt a lot of things around it, sharing it below for better…