Skip to content

fix: mask_id extraction assumes single-token encoding - #79

Open
andrewwhitecdw wants to merge 1 commit into
NVlabs:mainfrom
andrewwhitecdw:bugfix/run-chatbot-564bf47a
Open

fix: mask_id extraction assumes single-token encoding#79
andrewwhitecdw wants to merge 1 commit into
NVlabs:mainfrom
andrewwhitecdw:bugfix/run-chatbot-564bf47a

Conversation

@andrewwhitecdw

@andrewwhitecdw andrewwhitecdw commented Jul 27, 2026

Copy link
Copy Markdown

Problem

fix: mask_id extraction assumes single-token encoding

Fix

Replace:

    mask_id = int(tokenizer.encode("|<MASK>|", add_special_tokens=False)[0])

with:

    mask_token = "|<MASK>|"
    mask_ids = tokenizer.encode(mask_token, add_special_tokens=False)
    if len(mask_ids) != 1:
        raise ValueError(f"Expected {mask_token!r} to map to a single token, got {mask_ids}")
    mask_id = int(mask_ids[0])

Files changed

  • fast_ddrive/run_chatbot.py

@andrewwhitecdw
andrewwhitecdw marked this pull request as ready for review August 3, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant