fairseq icon indicating copy to clipboard operation
fairseq copied to clipboard

Recreate sentencepiece.bpe.model for old model trained on data created by fastBPE

Open ever4244 opened this issue 5 years ago • 2 comments

I trained a model using fairseq-train without spm, but I found that I need a "sentencepiece.bpe.model" for later task.

I used a script similar to fairseq translation example: prepare-wmt14en2de.sh, it does not generate a sentence piece model. And I prepare the data and train the old model with it.

https://github.com/pytorch/fairseq/tree/master/examples/translation

while the one that has a sentence piece model is: prepare-iwslt17-multilingual.sh python "$SPM_TRAIN" --input=$TRAIN_FILES --model_prefix=$DATA/sentencepiece.bpe --vocab_size=$BPESIZE --character_coverage=1.0 --model_type=bpe.

I am currently want to re-learn the sentencepiece.bpe.model on the training data for prepare-wmt14en2de.sh.

Since I already trained the model without the sentencepiece.bpe.model, I just want to make sure I can get the exact same training data when I reapply the spm learning script on the old data. So that my previously trained model from prepare-wmt14en2de.sh can be coupled with the newly learnt sentencepiece.bpe.model

However, In prepare-wmt14en2de.sh it use: fastBPE's learn_bpe.py, https://github.com/glample/fastBPE in prepare-iwslt17-multilingual.sh it use: sentencepiece's spm_train.py https://github.com/google/sentencepiece

They use different codes for bpe learning and encoding. They even use different BPE replacement tokens (@@ for fastBPE and _ for sentencepiece ). So how can create a sentencepiece.bpe.model that can be used together with my old model from fastBPE? (That is a sentencepiece.bpe.model which will generate the exact same training data as fastBPE)

Thank you very much!

ever4244 avatar Apr 23 '21 03:04 ever4244

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

stale[bot] avatar Apr 17 '22 19:04 stale[bot]

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!

stale[bot] avatar Apr 28 '22 22:04 stale[bot]