Skip to content
プロジェクト

概要

Pure Rust GGUF tokenizer: 100% llama.cpp parity, zero C/C++ FFI, zero unsafe, WASM-ready. Free forever.

AI・機械学習

この数値の測り方

計測したスター増加

24時間
0
7日間
+1
15日間
+1
1か月
履歴を収集中

期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。

shimmytok - Pure Rust tokenizer for GGUF models

Pure Rust tokenizer for GGUF models

ShimmyTok 0.8.5 • checked GGUF metadata • fixture-scoped compatibility

License: MIT OR Apache-2.0 Trans rights LGBTQ+ friendly Crates.io Rust Sponsor

Languages / 语言 / 語言: English · 简体中文 · 繁體中文


shimmytok is free forever. Choose MIT OR Apache-2.0 and retain the applicable license notices.

Support

This project is independently maintained and free forever. Sponsorship helps fund ongoing development, certification, compatibility work, and releases.

Sponsor on GitHub · Buy Me a Coffee

Any amount is appreciated. Suggested tiers:

  • $5/month — Thanks
  • $15/month — Supporter
  • $50/month — Backer
  • Custom — Email for invoicing

ShimmyTok 0.8.5

ShimmyTok is a Rust library for loading GGUF tokenizers. This release shares a checked GGUF manifest parser with Airframe, preserves the existing tokenizer API, and adds permanent malformed-array allocation regression tests. See the versioned changelog and parser security notes.

Tokenizer support is not inference support. Reading a vocabulary or recognizing a model name does not certify its neural-network execution in Airframe or Shimmy. Compatibility comparisons apply to the exact tested fixtures and options; there is no universal llama.cpp parity guarantee.

Implementation coverage

The current dispatcher in Tokenizer::from_vocab selects these implementations:

GGUF tokenizer model Implementation
llama, mistral, gemma, gemma4, gemma6 SentencePiece
gpt2, qwen, qwen2 BPE
bert, wpm WordPiece
rwkv RWKV
t5, ugm Unigram
plamo2 PLaMo-2

Other tokenizer-model values return an unsupported-model error. Implementation availability is separate from independent token-for-token fixture validation. A family name is not a promise that every vocabulary, normalization rule or pre-tokenizer revision is compatible.

Installation

Add the published 0.8.5 library to a Rust project:

cargo add [email protected]

Or use:

[dependencies]
shimmytok = "0.8.5"

This package is a library, not a cargo install command-line application. The default parallel feature enables optional Rayon batch processing. default-features = false selects the sequential batch implementation.

Quick Start

Use an existing GGUF file containing a supported tokenizer:

use shimmytok::{EncodeOptions, Tokenizer};

fn main() -> Result<(), shimmytok::Error> {
    let tokenizer = Tokenizer::from_gguf_file("model.gguf")?;
    let options = EncodeOptions::with_parse_special(true, true);
    let ids = tokenizer.encode_with_options("Hello, world!", &options)?;
    let decoded = tokenizer.decode(&ids, true)?;
    println!("{decoded}");
    Ok(())
}

Choose special-token options to match the actual model/template contract. Avoid adding a second BOS to a prompt whose template already supplies it. Explicit GGUF special-token metadata takes precedence over family defaults; this release does not add another BOS-default correction.

API and compatibility

encode, encode_with_options, decode, decode_single, encode_batch, get_token, special-token accessors and read-only metadata remain available. See the API stability contract for signatures, opt-in external-special-token behavior and upgrade boundaries.

Batch output preserves input order; each item follows the corresponding single encode operation. The sequential/parallel error contract selects the lowest failing input index. No new universal performance or cross-platform certification is implied by those API contracts.

The coordinated dense-inference fixtures use exact Qwen3 and Llama model/token hashes and reference conditions documented by Shimmy. Those engine tests do not certify every tokenizer implementation above against every llama.cpp revision. New models require their own exact-ID comparisons, including normalization, added tokens, byte fallback and prompt framing.

Security and platforms

The public GGUF reader validates declared lengths, tensor bounds/alignment and checked allocation budgets before consuming untrusted payloads. The permanent security regression exercises impossible array counts, budgets, overflow and truncation alongside a valid bounded vocabulary. These checks do not make arbitrary model files harmless or provide unbounded resource guarantees for every tokenizer algorithm.

Local package tests ran on Linux under WSL. The later integrated engine qualification also exercised exact Qwen3/Llama token IDs on Apple M1 (Virtual), macOS 15.8.2. Broader standalone native-platform tokenizer suites, WASM/WASI and minimum-toolchain certification remain NOT_RUN. Rust portability or a sequential code path is not evidence of execution on a particular target. Use source builds and report exact target/toolchain failures.

Links

Related Projects

License

Dual-licensed MIT OR Apache-2.0 — free forever, no strings attached.


Maintainer: Michael A. Kuykendall
Mission: Pure Rust tokenization for the LLM ecosystem

Support

This project is a safe space. Trans rights are human rights.

If you or someone you love needs support:

関連プロジェクトを探す

読み込み中…