Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Legacy Huggingface text vocabularies use raw lines for tokens and merge rules. On POSIX,
getlineremoves LF but leaves a CRLF record's CR in both fields. The factory can return an object, then encoding fails because the expected vocabulary keys are missing. Windows text-mode streams already handle these record endings.For example, this small legacy vocabulary reproduces the issue when loaded by the production factory on Android ARM64:
Encoding
heshould return[2]. The current Android parser retains the record CRs and aborts during encoding; the LF control and Windows parser return[2].Use the numeric count header to identify consistent CRLF records, then remove exactly one terminal record CR from vocabulary and merge lines. Keep LF-mode content and the last unterminated record unchanged. This only changes
HuggingfaceTokenizer::load_vocab; it keeps the existing text stream, factory failure behavior, other formats and public interfaces. It is independent of #5034 and does not change the Pipeline binary-loading fix in #4691.Validation:
The protocol assumes consistent record endings. Mixed endings, general malformed-resource validation, I/O faults, macOS/Linux desktop builds, model quality and performance are not covered. No new test-framework changes or temporary reproduction tools are included.
Module
LLM
Type
Checklist
[Module:Type] Descriptionformat