Skip to content

[docs] Fix decode examples and expected output in fast_tokenizers - #47369

Merged
Rocketknight1 merged 1 commit into
huggingface:mainfrom
samyuktahegde:fix-fast-tokenizers-docs
Jul 17, 2026
Merged

[docs] Fix decode examples and expected output in fast_tokenizers#47369
Rocketknight1 merged 1 commit into
huggingface:mainfrom
samyuktahegde:fix-fast-tokenizers-docs

Conversation

@samyuktahegde

@samyuktahegde samyuktahegde commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

CI

What does this PR do?

While working through the Fast Tokenizers documentation to understand encode()/decode(), I observed a few inconsistencies. This PR updates the examples to match the observed behavior and keeps the documentation consistent across the page.

Documentation Changes

Encode and decode section:

  • Replaces tokenizer.decode(outputs["input_ids"]) with tokenizer.decode(input_ids)
    as tokenizer.encode() returns just a list of token IDs rather than an object.
  • Updates the expected output of tokenizer.decode() to display that it returns a string (instead of a list).

Special tokens section:

  • Applies the same corrections to the repeated decode() example by replacing outputs["input_ids"] with input_ids and updating the expected output to a string.

Fixes # (issue)

Code Agent Policy

The Transformers repo is currently being overwhelmed by a large number of PRs and issue comments written by
code agents. These often are low-quality, or fix extremely minor issues that occur rarely or never in practice.
As a result, we're instituting a rule that first-time contributors should not use code agents to submit PRs or issues.
We'd also ask autonomous "OpenClaw"-like agents not to open any PRs or issues.

Issues/PRs from first-time contributors that violate this rule will probably just be closed without review, and we
might block you, especially if you open more than one or appear to be deliberately ignoring this. We especially do not
want new contributors to jump in on random issues to contribute an agent-written fix. This creates lots of noise
for reviewers and other users and will almost certainly get you blocked.

For more information, please read CONTRIBUTING.md.

  • (First-time contributors only): I confirm that this PR description and code is not written by an LLM or code agent

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline and the
    Pull Request checks?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes according to the guidelines?
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@github-actions

Copy link
Copy Markdown
Contributor

CI recap

Dashboard: View test results in Grafana
Latest run: 29501835760
Result: success | Grafana metrics are not available yet.

@Rocketknight1 Rocketknight1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this does look cleaner, and it matches the unbatched decoding logic. Thank you!

@Rocketknight1
Rocketknight1 enabled auto-merge July 17, 2026 14:01
@samyuktahegde

Copy link
Copy Markdown
Contributor Author

Thank you for the review and approval.

@Rocketknight1
Rocketknight1 added this pull request to the merge queue Jul 17, 2026
Merged via the queue into huggingface:main with commit a20c75c Jul 17, 2026
32 checks passed
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@samyuktahegde
samyuktahegde deleted the fix-fast-tokenizers-docs branch July 21, 2026 04:33
stevhliu pushed a commit to stevhliu/transformers that referenced this pull request Jul 30, 2026
Sainava pushed a commit to Sainava/Sai-transformers that referenced this pull request Aug 3, 2026
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.

3 participants