Feat: Support dynamic ONNX model loading from HF (maintaining zero-dependency)#46
Open
Kagandi wants to merge 7 commits intoPrithivirajDamodaran:mainfrom
Open
Feat: Support dynamic ONNX model loading from HF (maintaining zero-dependency)#46Kagandi wants to merge 7 commits intoPrithivirajDamodaran:mainfrom
Kagandi wants to merge 7 commits intoPrithivirajDamodaran:mainfrom
Conversation
…el file download process
|
Worked as intended with onnx-community/bge-reranker-v2-m3-ONNX |
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:
I’ve read your comments regarding the design philosophy of Flashrank—specifically the goal to keep the library curated, lightweight, and focused on "tiny and performant" models. I fully agree that Flashrank should not become a heavy wrapper for massive models.
However, I believe this PR strengthens that mission while improving maintainability:
Decoupling Code from Models: Currently, adding a new "tiny/performant" model requires a code change and a release by you. This PR allows the community to experiment with new lightweight ONNX models immediately.
Zero Dependencies: This uses the existing architecture and does not add new dependencies.
Strictly Lightweight (Proposed Safeguard): To ensure this feature doesn't violate the "Flashrank" ethos, I can implement a hard file-size limit (e.g., < 200MB) for custom loaded models. This guarantees that users cannot load massive/slow models, keeping the library true to its name while offering flexibility.
This change allows the library to remain "light and fast" while offloading the burden of constant model updates from the maintainers.
Changes
refactor
download_file()function to eliminate code duplicationfeat
_download_hf_model_files()to fetch models using HuggingFace URLsfix
token_type_idspresence in ONNX model inputs before using themchore
setup.py