Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
eeed581
add fasttokens
michaelfeil Mar 19, 2026
df01fd7
Add async batch Python API
michaelfeil Jul 11, 2026
271af52
release gil during Python encode
michaelfeil Jul 11, 2026
acb2469
fix encode gil release build inference
michaelfeil Jul 11, 2026
85f9eac
build free-threaded wheels with Python 3.14
michaelfeil Jul 11, 2026
1d1ad55
Merge pull request #3 from michaelfeil/codex/release-gil-encode
michaelfeil Jul 11, 2026
e656d08
release: Bump version to 0.2.0
michaelfeil Jul 11, 2026
7aebd2d
Merge pull request #5 from michaelfeil/codex/release-0.2.0
michaelfeil Jul 11, 2026
8def2de
Reject unsupported special token options
michaelfeil Jul 11, 2026
bbbbde7
Merge pull request #6 from michaelfeil/codex/reject-unsupported-speci…
michaelfeil Jul 11, 2026
6f33423
Rename crates package to fasttokens-b10
Copilot Jul 11, 2026
ac8e230
Correct fork package name to fastokens-b10
Copilot Jul 11, 2026
49aefde
support split special token encoding
michaelfeil Jul 11, 2026
fbeab04
avoid cloning added token patterns
michaelfeil Jul 11, 2026
3e87d4b
Respect special token split options in shim
michaelfeil Jul 11, 2026
72b7361
test Kimi split special tokens against HF
michaelfeil Jul 11, 2026
71b7fd6
simplify split special empty input
michaelfeil Jul 11, 2026
3ecaa89
address split special review followups
michaelfeil Jul 11, 2026
de6bb55
expand split special rust coverage
michaelfeil Jul 11, 2026
6a2f953
match HF split special overlap behavior
michaelfeil Jul 11, 2026
7c5f6d4
fail loudly on missing added token match
michaelfeil Jul 11, 2026
869edc9
skip split scan for all-special added tokens
michaelfeil Jul 11, 2026
adb0219
Merge pull request #4 from michaelfeil/codex/split-special-tokens
michaelfeil Jul 11, 2026
f90d62b
Add structural token encoding API
michaelfeil Jul 11, 2026
525cb05
Merge pull request #7 from michaelfeil/copilot/fastokens-b10
michaelfeil Jul 11, 2026
9a4e10e
Revert "Add structural token encoding API"
michaelfeil Jul 11, 2026
fdbb1c0
Merge pull request #9 from michaelfeil/codex/revert-structural-token-api
michaelfeil Jul 11, 2026
5496211
[codex] Add structural token encoding API (#10)
michaelfeil Jul 11, 2026
f01941e
Bump version to 0.2.1 (#11)
michaelfeil Jul 11, 2026
4da6618
Run Python CI on 3.12 only (#14)
Copilot Jul 12, 2026
2ab238a
Vendor tokenizer assets
michaelfeil Jul 12, 2026
9cc4d0d
Add tiktoken to tokenizer.json conversion helper (#13)
Copilot Jul 12, 2026
24712ae
[codex] Add numpy ID accessors (#12)
michaelfeil Jul 12, 2026
f0c710c
chore: bump version to 0.2.2 (#16)
Copilot Jul 12, 2026
aa94cf6
fix kimi tiktoken added token ids (#17)
michaelfeil Jul 15, 2026
35e8e8c
bump version to 0.2.3
michaelfeil Jul 15, 2026
18bb140
exclude tokenizer fixtures from crate package
michaelfeil Jul 15, 2026
a883e56
Add manual dispatch to CI workflows (#18)
Copilot Jul 24, 2026
113ed99
Enable PCRE2 for tokenizer regex intersections (#19)
michaelfeil Jul 24, 2026
f85fce7
Add files via upload
michaelfeil Jul 24, 2026
586e5b9
Add files via upload (#21)
michaelfeil Jul 24, 2026
97a219b
Vendor Kimi 2.5 chat template files
michaelfeil Jul 24, 2026
ae3fc30
bump version with segmnt encoding (#23)
michaelfeil Jul 25, 2026
a86ce6a
Add native apply_chat_template with transformers parity (#22)
michaelfeil Jul 25, 2026
b32ae87
Lazily materialize Encoding numpy fields (#27)
michaelfeil Jul 26, 2026
2ae76b0
Bump version to 0.2.6
michaelfeil Jul 26, 2026
10c0389
Specialized split scanner tier: ~2x faster e2e for Qwen3/GLM/gpt-oss/…
michaelfeil Jul 26, 2026
ac67575
Bump stable ABI floor from abi3-py39 to abi3-py310 (#29)
michaelfeil Jul 26, 2026
7c123aa
Optimize cold BPE merges and shared cache
michaelfeil Jul 26, 2026
27edc8c
Add cold long-context tokenization benchmark
michaelfeil Jul 26, 2026
60188f7
Report tokenizer load time in long-context benchmark
michaelfeil Jul 26, 2026
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
6 changes: 3 additions & 3 deletions .github/workflows/build-maturin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
if: ${{ matrix.platform.ft }}
with:
target: ${{ matrix.platform.target }}
args: --release --out dist -i python3.13t
args: --release --out dist -i python3.14t
sccache: "false"
manylinux: auto
before-script-linux: |
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist -i python3.13t
args: --release --out dist -i python3.14t
sccache: "false"
manylinux: musllinux_1_2
- name: Upload wheels
Expand Down Expand Up @@ -175,7 +175,7 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist -i python3.13t
args: --release --out dist -i python3.14t
sccache: "false"
- name: Upload wheels
uses: actions/upload-artifact@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-release-fastokens.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ jobs:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- name: Verify package
run: cargo publish -p fastokens --dry-run --locked
run: cargo publish -p fastokens-b10 --dry-run --locked
- name: Publish
if: ${{ github.event_name == 'workflow_dispatch' && fromJSON(github.event.inputs.publish) }}
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish -p fastokens --locked
run: cargo publish -p fastokens-b10 --locked
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ on:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
HF_TOKEN: ${{ secrets.HF_TOKEN }}

jobs:
test:
Expand Down Expand Up @@ -49,6 +51,9 @@ jobs:
- name: Build and install wheel
run: maturin build --release --out dist && pip install dist/*.whl

- name: Install Python test dependencies
run: pip install pytest tiktoken

- name: Smoke test
run: |
python - <<'EOF'
Expand All @@ -61,6 +66,9 @@ jobs:
print("smoke test passed")
EOF

- name: Run Python tests
run: pytest python/tests -v

patch-transformers:
runs-on: ubuntu-latest
strategy:
Expand All @@ -85,7 +93,7 @@ jobs:
run: maturin build --release --out dist && pip install dist/*.whl

- name: Install transformers ${{ matrix.transformers }} and pytest
run: pip install transformers==${{ matrix.transformers }} pytest
run: pip install transformers==${{ matrix.transformers }} pytest jinja2

- name: Test patch_transformers
run: pytest python/tests/test_patch_transformers.py -v
62 changes: 62 additions & 0 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Python CI

on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
HF_TOKEN: ${{ secrets.HF_TOKEN }}

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- uses: dtolnay/rust-toolchain@stable

- uses: Swatinem/rust-cache@v2

- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip

- name: Cache Hugging Face tokenizers
uses: actions/cache@v4
with:
path: |
~/.cache/huggingface/hub
~/.cache/huggingface/xet
~/.cache/tokenizers
key: ${{ runner.os }}-py3.12-hf-tokenizers-${{ hashFiles('pyproject.toml', 'python/Cargo.toml', 'Cargo.lock', '.github/workflows/python-ci.yml') }}
restore-keys: |
${{ runner.os }}-py3.12-hf-tokenizers-
${{ runner.os }}-hf-tokenizers-

- name: Configure Hugging Face token
run: |
if [ -n "${HF_TOKEN:-}" ]; then
mkdir -p ~/.cache/huggingface
printf '%s' "$HF_TOKEN" > ~/.cache/huggingface/token
fi

- name: Install Python test dependencies
run: python -m pip install --upgrade pip maturin pytest transformers==4.57.1 jinja2

- name: Build and install fastokens
run: maturin build --release --out dist && pip install dist/*.whl

- name: Run Python tests
run: pytest python/tests -v

- name: Remove Hugging Face token before cache save
if: always()
run: rm -f ~/.cache/huggingface/token
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ __pycache__/
*.pyd

dist/
target/
target/
vendored_tokenizers/private_*
Loading
Loading