Skip to content

Feature/complete sentencepiece tokenizer#65

Open
Arpitsh7 wants to merge 3 commits intoAOSSIE-Org:mainfrom
Arpitsh7:feature/complete-sentencepiece_tokenizer
Open

Feature/complete sentencepiece tokenizer#65
Arpitsh7 wants to merge 3 commits intoAOSSIE-Org:mainfrom
Arpitsh7:feature/complete-sentencepiece_tokenizer

Conversation

@Arpitsh7
Copy link
Contributor

Summary

Completes the SentencePieceTokenizer implementation introduced in #17 by adding encode(), decode(), and load() — making SentencePieceTokenizer fully usable in the pipeline.


Background

PR #17 introduced a modular tokenizer architecture with SentencePieceTokenizer as one of the implementations. However the current SentencePieceTokenizer only supports training and lacks encode(), decode(), and load().

Since these methods are absent, the tokenizer cannot process text despite being trained, which prevents it from being used in downstream pipeline tasks.


Changes

openverifiablellm/tokenizer/sentencepiece_tokenizer.py

  • Implemented encode(text) -> list[int]
  • Implemented decode(ids) -> str
  • Implemented load(tokenizer_dir) — reloads from vocab.json + merges.txt
  • Added text_file.is_file() validation in train()
  • Added _check_loaded() guard for encode/decode

tests/test_sentencepiece.py ← new file

  • 18 tests covering training, encode/decode roundtrip, load, artifact paths, special tokens, determinism, and constructor validation

Testing

pytest tests/test_sentencepiece.py -v

All 18 tests pass.


Scope

Self-contained change. Touches only sentencepiece_tokenizer.py and tests/test_sentencepiece.py. No overlap with any open PR.

Related

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 11, 2026

Warning

Rate limit exceeded

@Arpitsh7 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 13 minutes and 30 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4671d880-3136-476c-9df1-8a6e3f5a7a8a

📥 Commits

Reviewing files that changed from the base of the PR and between a2dfd7a and 0b54e19.

📒 Files selected for processing (4)
  • .gitignore
  • openverifiablellm/tokenizer/sentencepiece_tokenizer.py
  • openverifiablellm/verify.py
  • tests/test_sentencepiece.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size/L and removed size/L labels Mar 11, 2026
@Arpitsh7
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 11, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant