Skip to content

Logits display improvements#7486

Open
wiger3 wants to merge 1 commit intooobabooga:devfrom
wiger3:0001-logits
Open

Logits display improvements#7486
wiger3 wants to merge 1 commit intooobabooga:devfrom
wiger3:0001-logits

Conversation

@wiger3
Copy link
Copy Markdown

@wiger3 wiger3 commented Apr 11, 2026

This PR addresses the following issues with the logits viewer:

  • display special tokens (like eot) properly
    Previously, the logits viewer would display blank strings for special tokens like end of turn, eos, etc. This seems to be a llama-server bug, but we can work around it on the client-side by re-decoding blank tokens.
  • escape control characters for display properly instead of messing with repr
    Previously, each token would go through repr and some buggy logic to strip apostrophes. That was a bad approach because repr can surround with either style of Python quotes - apostrophes (0x27) or quotes (0x22), depending on the content. It will also escape backslashes, quotes, and other special characters, which isn't desirable for a visual representation of tokens. Instead, we escape only control characters (ASCII C0 and Unicode C1) and leave the rest alone.
  • change output formatting of the logits viewer to be clearer and show token ids
    The old formatting was confusing to me - many tokens begin with spaces so it was hard to see what token would actually be emitted by the model. Token IDs are also useful if we want to ban some tokens. I've changed the format to probability - [token] (token id)

Checklist:

- display special tokens (like eot) properly
- escape control characters for display properly instead of messing with repr
- change output formatting of the logits viewer to be clearer and show token ids
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