YouTokenToMe icon indicating copy to clipboard operation
YouTokenToMe copied to clipboard

how to get vocab

Open wqfengnlpr opened this issue 4 years ago • 2 comments

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

wqfengnlpr avatar Apr 30 '20 16:04 wqfengnlpr

bpe = yttm.BPE(model='./yttm.model') bpe.vocab()

dantougit avatar Jul 04 '20 01:07 dantougit

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().

wqfengnlpr avatar Aug 12 '20 13:08 wqfengnlpr