Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add test case for encode with is_start=False #74

Merged
merged 2 commits into from
Dec 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions tests/test_jurassic_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ def test_tokenizer_encode_set(tokenizer: JurassicTokenizer, resources_path: Path
), f"Not equal at doc {i}"


def test_tokenizer_encode_set_when_is_start_false(tokenizer: JurassicTokenizer, resources_path: Path):
tokenized_docs_path = resources_path / "200_tokenized_C4_val_docs.jsonl"
with tokenized_docs_path.open("r") as tokenized_docs_file:
for i, tokenized_doc_line in enumerate(tokenized_docs_file.readlines()):
tokenized_doc = json.loads(tokenized_doc_line)
assert tokenized_doc["token_ids_start_false"] == tokenizer.encode(
asafgardin marked this conversation as resolved.
Show resolved Hide resolved
tokenized_doc["doc_text"], is_start=False
), f"Not equal at doc {i}"


@pytest.mark.parametrize(
ids=[
"when_single_int__should_return_single_str",
Expand Down
Loading