convert : fetch tokenizer vocab and remote code with --remote - #26193
Closed
GrEarl wants to merge 2 commits into
Closed
convert : fetch tokenizer vocab and remote code with --remote#26193GrEarl wants to merge 2 commits into
GrEarl wants to merge 2 commits into
Conversation
|
Hi @GrEarl, thanks for your contribution! Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:
Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below. |
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.
--remotecurrently downloads["LICENSE", "*.json", "*.md", "*.txt", "tokenizer.model"]. Two kinds of tokenizer files are not covered, soset_vocab()fails for models that need them even though the same model converts fine from a full local snapshot:tiktoken.model— where Kimi K2 / K2.5 / K3 keep their vocabulary. Not matched bytokenizer.model.*.py— several converters callAutoTokenizer.from_pretrained(self.dir_model, trust_remote_code=True), which resolves the tokenizer class from the model directory. For Kimi that istokenization_kimi.py, which in turn relative-importsencoding_k3.py.Concretely, on
moonshotai/Kimi-K3viakimi_linear.py:deepseek.pyreaches the same call for Kimi-K2/K2.5, so this is not specific to one architecture.Measured on
moonshotai/Kimi-K3withsnapshot_download:tiktoken.modeltokenization_kimi.pyencoding_k3.py+2.84 MiB. Most of the 57 MiB in both cases ismodel.safetensors.index.json, already pulled by*.json.*.modelsubsumes the existingtokenizer.modelentry, so that one is dropped rather than kept alongside.On
*.py: this only makes--remotematch what already happens for a local directory. The converters that need these files already run them viatrust_remote_code=True; today the download simply omits them and the conversion aborts. If pulling model code unconditionally is not wanted, the alternative is to pass the already-availableself.remote_hf_model_idtoAutoTokenizer.from_pretrainedso transformers resolves the code from the Hub, but that touches every converter that makes the call rather than one line here.Not verified: I have not run a full
--remoteconversion to completion on a model that needs this — the download side is what I measured. Found while testing #26185 (model: add Kimi-K3 text model), where--remotestops inset_vocabfor this reason; details in #26185 (comment)AI usage disclosure: yes. The before/after file listing above is output from a command I ran; the change is the one line shown in the diff.