Skip to content

Commit f3fe994

Browse files
committed
update test + lockfile
1 parent 940aed8 commit f3fe994

2 files changed

Lines changed: 18 additions & 11 deletions

File tree

tests/test_distillation.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,17 @@ def test_distill_removal_pattern_all_tokens(
9292
mock_model_info.return_value = type("ModelInfo", (object,), {"cardData": {"language": "en"}})
9393
mock_auto_model.return_value = mock_transformer
9494

95-
with pytest.raises(ValueError):
96-
distill_from_model(
97-
model=mock_transformer,
98-
tokenizer=mock_berttokenizer,
99-
vocabulary=None,
100-
device="cpu",
101-
token_remove_pattern=r".*",
102-
)
95+
# Even if we remove all tokens, we can't remove the [UNK] token
96+
model = distill_from_model(
97+
model=mock_transformer,
98+
tokenizer=mock_berttokenizer,
99+
vocabulary=None,
100+
device="cpu",
101+
token_remove_pattern=r".*",
102+
)
103+
104+
# So the only token left is the [UNK] token.
105+
assert model.tokens == ("[UNK]",)
103106

104107

105108
@patch.object(import_module("model2vec.distill.distillation"), "model_info")

uv.lock

Lines changed: 7 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)