Skip to content

Add sentencepiece@0.2.1 - #9552

Merged
Wyverald merged 1 commit into
bazelbuild:mainfrom
BYVoid:sentencepiece-0.2.2pre1
Jul 7, 2026
Merged

Add sentencepiece@0.2.1#9552
Wyverald merged 1 commit into
bazelbuild:mainfrom
BYVoid:sentencepiece-0.2.2pre1

Conversation

@BYVoid

@BYVoid BYVoid commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Adds SentencePiece v0.2.1 as a new module.

The Bazel build definitions are taken from the upstream PR google/sentencepiece#1280 (not yet merged), adapted for the 0.2.1 release tarball:

  • overlay/BUILD.bazel + overlay/src/BUILD.bazel: root aliases, //src:sentencepiece (runtime), //src:sentencepiece_train (trainer), and the spm_{train,encode,decode,normalize,export_vocab} CLIs. The protobuf code is regenerated from src/*.proto at build time (matching the SPM_PROTOBUF_PROVIDER=package CMake configuration). defines = ["_USE_EXTERNAL_ABSL"] selects the external-absl branch of error.cc, which defines the --minloglevel flag (normally supplied by the vendored mini-absl shim's flag.cc), matching the SPM_ABSL_PROVIDER=module|package CMake configurations.
  • patches/use_bcr_dependency_includes.patch: rewrites #include "third_party/absl/...""absl/...", "third_party/darts_clone/darts.h""darts.h", and "third_party/esaxx/esa.hxx""esa.hxx" so the sources resolve against the BCR modules (abseil-cpp, darts-clone@0.32h.bcr.1, esaxx@20250106.1.bcr.1) instead of the vendored copies.
  • The release tarball is a Python sdist, so strip_prefix is sentencepiece-0.2.1/sentencepiece. It does not ship the data/ directory, so the upstream spm_test target is not included. Instead, the overlay adds a bcr_tests/ test module (bcr_test_module in presubmit) with an in-memory train → encode → decode roundtrip cc_test; presubmit also verifies all library and CLI targets on Linux/macOS/Windows with C++17 flags.

Locally verified: all targets build (Bazel 9.1.1), the bcr_tests roundtrip test passes, spm_train/spm_encode work end to end, and bcr_validation.py --check sentencepiece@0.2.1 passes.

@BYVoid
BYVoid force-pushed the sentencepiece-0.2.2pre1 branch from 1582b63 to 6e85926 Compare July 3, 2026 17:06
@BYVoid
BYVoid marked this pull request as ready for review July 3, 2026 17:13
@bazel-io

bazel-io commented Jul 3, 2026

Copy link
Copy Markdown
Member

Hello BCR maintainers, modules without existing maintainers (sentencepiece) have been updated in this PR.
Please review the changes. You can view a diff against the previous version in the "Generate module diff" check.

@bazel-io
bazel-io requested review from a team, cerisier and fweikert and removed request for a team July 3, 2026 17:13
@Wyverald Wyverald added the presubmit-auto-run Presubmit jobs will be triggered for new changes automatically without reviewer's approval label Jul 6, 2026
@BYVoid
BYVoid force-pushed the sentencepiece-0.2.2pre1 branch from 6e85926 to 812b18c Compare July 6, 2026 22:06
@BYVoid BYVoid changed the title Add sentencepiece@0.2.2pre1 Add sentencepiece@0.2.1 and 0.2.2pre1 Jul 6, 2026
@BYVoid
BYVoid force-pushed the sentencepiece-0.2.2pre1 branch from aa19625 to 68bbac0 Compare July 6, 2026 22:44
@BYVoid BYVoid changed the title Add sentencepiece@0.2.1 and 0.2.2pre1 Add sentencepiece@0.2.1 Jul 6, 2026
@Wyverald
Wyverald merged commit 164ab3f into bazelbuild:main Jul 7, 2026
22 checks passed
@BYVoid
BYVoid deleted the sentencepiece-0.2.2pre1 branch July 7, 2026 02:10
@BYVoid BYVoid mentioned this pull request Jul 14, 2026
bazel-io pushed a commit that referenced this pull request Jul 14, 2026
Adds [SentencePiece](https://github.com/google/sentencepiece) v0.2.2,
following up on #9552 (sentencepiece@0.2.1).

Same approach as 0.2.1, with the Bazel build definitions taken from the
upstream PR google/sentencepiece#1280 (not yet merged), adapted for the
0.2.2 release tarball:

- `overlay/BUILD.bazel` + `overlay/src/BUILD.bazel`: root aliases,
`//src:sentencepiece` (runtime), `//src:sentencepiece_train` (trainer),
and the `spm_{train,encode,decode,normalize,export_vocab}` CLIs. The
protobuf code is regenerated from `src/*.proto` at build time (matching
the `SPM_PROTOBUF_PROVIDER=package` CMake configuration).
- `patches/use_bcr_dependency_includes.patch`: rewrites `#include
"third_party/absl/..."` → `"absl/..."`,
`"third_party/darts_clone/darts.h"` → `"darts.h"`, and
`"third_party/esaxx/esa.hxx"` → `"esa.hxx"` so the sources resolve
against the BCR modules (abseil-cpp, darts-clone@0.32h.bcr.1,
esaxx@20250106.1.bcr.1) instead of the vendored copies.
- The release tarball is a Python sdist, so `strip_prefix` is
`sentencepiece-0.2.2/sentencepiece`. It does not ship the `data/`
directory, so the upstream `spm_test` target is not included. Instead,
the overlay adds a `bcr_tests/` test module (`bcr_test_module` in
presubmit) with an in-memory train → encode → decode roundtrip
`cc_test`; presubmit also verifies all library and CLI targets on
Linux/macOS/Windows with C++17 flags.

Differences from 0.2.1: 0.2.2 uses `init.cc` (renamed from `error.cc`),
migrated to absl::Status/log (more abseil-cpp deps, no
`_USE_EXTERNAL_ABSL` define needed), and its `MODULE.bazel` pins
abseil-cpp 20260526.0 to match the `GIT_TAG` in `CMakeLists.txt`.

Locally verified: all targets build (Bazel 9.1.1), the `bcr_tests`
roundtrip test passes, and `bcr_validation.py --check
sentencepiece@0.2.2` passes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

presubmit-auto-run Presubmit jobs will be triggered for new changes automatically without reviewer's approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants