Make sure TrainerWrapper can only train the right Model

This commit is contained in:
Anthony MOI
2020-11-20 09:02:28 -05:00
committed by Anthony MOI
parent 13e07da2c8
commit 2fbd6779f6
2 changed files with 25 additions and 4 deletions

View File

@ -92,3 +92,10 @@ class TestUnigram:
"t ",
"[SEP]",
]
def test_cannot_train_different_model(self):
tokenizer = Tokenizer(models.BPE())
trainer = trainers.UnigramTrainer(show_progress=False)
with pytest.raises(Exception, match="UnigramTrainer can only train a Unigram"):
tokenizer.train([], trainer)