Model¶
ffbpe.model.BpeModel
¶
An immutable BPE model produced by :meth:BpeTrainer.validate_model.
Source code in python/ffbpe/model.py
last_merge_freq
property
¶
Frequency of the final pair merge, if the model contains one.
encoder
¶
encoder(*, pat_str=None, unicode_bigrams=None, unicode_bigram_mixed_boundary='keep', split_on_vocab_bigrams=True)
Build an encoder directly from this model.
Source code in python/ffbpe/model.py
encode
¶
decode
¶
save_vocab_json
¶
Save the validated vocabulary to a JSON file.
save_merges_txt
¶
Save the validated merge list to a text file.
save
¶
Save vocab.{name}[{unit}].json and merges.{name}[{unit}].txt into outdir.
Source code in python/ffbpe/model.py
save_files
¶
Save the validated vocabulary and merge list to explicit paths.
Source code in python/ffbpe/model.py
save_pretrained
¶
save_pretrained(directory, *, format=None, pat_str=None, unicode_bigrams=None, unicode_bigram_mixed_boundary='keep', split_on_vocab_bigrams=True)
Save a self-describing model directory loadable by BpeEncoder.from_pretrained.