[Bug]: TransformersTokenizer vocabulary queries raise NotImplementedError

オープン
#23,252 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@JunkaiWang-TheoPhy がすでに取り組んでいます。

2026年12月2日 から。

  • #23254 @JunkaiWang-TheoPhy による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
python
領域
backend

調査の方向性

Find the TransformersTokenizer implementation and its tests in the TensorRT-LLM repository; the issue does not name their paths. Read how the wrapper delegates encoding and get_added_vocab(), then compare its vocabulary methods with the underlying Transformers tokenizer. Done when the three reproduction assertions pass; linked pull request #23254 is already open.

索引モデルが issue の本文から書いたものです。

説明

Frontend
System Info

TensorRT-LLM main ef375f87565b89a5818e705c735ec59a182efb86. Reproduced on Python 3.12/macOS ARM64 with Hugging Face Transformers and an in-memory Rust-backed WordLevel tokenizer. No GPU, model weights, or network is needed for the example. Native TensorRT startup was bypassed in the local CPU harness.

Reproduction
from tokenizers import Tokenizer
from tokenizers.models import WordLevel
from transformers import PreTrainedTokenizerFast

from tensorrt_llm.tokenizer import TransformersTokenizer

raw = PreTrainedTokenizerFast(
    tokenizer_object=Tokenizer(WordLevel({"<unk>": 0, "fox": 1}, unk_token="<unk>")),
    unk_token="<unk>",
)
raw.add_tokens(["whale"])
wrapped = TransformersTokenizer(raw)

assert wrapped.get_vocab() == raw.get_vocab()
assert len(wrapped) == len(raw) == 3
assert wrapped.vocab_size == raw.vocab_size == 2
Expected behavior

The wrapper should expose the underlying tokenizer's vocabulary map and distinguish the full length including added tokens from its base vocabulary size.

Actual behavior

All three wrapper operations raise NotImplementedError from PreTrainedTokenizerBase. The underlying tokenizer supports all three operations.

Additional notes

The wrapper already delegates encoding, decoding, token conversion, and get_added_vocab(); vocabulary introspection uses inherited base stubs instead. See the Transformers tokenizer interface. Searches for TransformersTokenizer get_vocab, TokenizerBase get_vocab, and vocabulary-related NotImplementedError did not identify an equivalent fix.

OpenAI Codex assisted with the reproduction.

主要言語
Python
スター
15.2k
フォーク
3k
平均マージ
2日 21時間
マージ済み PR(30日)
477

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

NVIDIA/TensorRT-LLM のほかの issue

NVIDIA/TensorRT-LLM の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。