Open
Conversation
…tion that does not check for tokenizer files or processor files if the task does not use them
Co-authored-by: Joshua Lochner <admin@xenova.com>
Co-authored-by: Joshua Lochner <admin@xenova.com>
…s.js into v4-cache-handler
breaks simultaneous loading
|
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. |
xenova
reviewed
Mar 1, 2026
Collaborator
There was a problem hiding this comment.
Nice idea! I think -- in any case, we should add a max cache size, kind of like how we do here: https://github.com/huggingface/tokenizers.js/blob/488865017c65e9b84b84ede4d7fa89f348dc0fea/src/utils/data-structures/LRUCache.ts#L4
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.
The
ModelRegistryhas two points where calls to the model host are made: fetching the model config (config.json) and fetching file metadatas. When a consumer first callsModelRegistry.get_model_filesto inspect what a model needs (display the total size on the dowload button) and then creates the pipeline, both of those network calls are made twice. Which is not necessary.This PR introduces a small
memoizePromiseutility that deduplicates promises by key. Whether the first call is still in-flight or already resolved, any subsequent call with the same key gets the same promise back. This is then applied toget_file_metadataand the newget_confighelper inget_model_files.js, so the config and metadata fetches each happen at most once per unique set of arguments.