YouTokenToMe
YouTokenToMe copied to clipboard
how to get vocab
Hi, I am very confused how the vocab function works. It seems the vocab only reads a model file, which only contains the token id without the mapping (the id and subword), so how can we get the subword from these ID?
I use the following order to get the vocab, and I am very surprised that the vocab file shows all subwords.
yttm vocab --model yttm.model >yttm.vocab
best wishes
bpe = yttm.BPE(model='./yttm.model') bpe.vocab()
bpe = yttm.BPE(model='./yttm.model') bpe.vocab()
I just wonder why this model can produce the vocab. Because the model file only contains the digital IDs, there is not any alphabet. So how does it get the mapping between the Id and alphabet in the function of Vocab().