Skip to content

feat(onnx): race Hugging Face and hf-mirror for model downloads - #415

Open
liukewia wants to merge 1 commit into
TencentCloud:developfrom
liukewia:feature/onnx-hf-mirror-download
Open

feat(onnx): race Hugging Face and hf-mirror for model downloads#415
liukewia wants to merge 1 commit into
TencentCloud:developfrom
liukewia:feature/onnx-hf-mirror-download

Conversation

@liukewia

Copy link
Copy Markdown
Contributor

Summary

  • Download local ONNX embedding models by racing Hugging Face and hf-mirror, then fetching from the faster source (with fallback).
  • Infer snapshot URLs from the catalog HF repo id (or the model id) so each model does not need a hand-written download URL.
  • Drop the previous official-only snapshot_download path in the ONNX download manager.

Target branch

  • Base is develop (feature / fix — default)
  • Base is main (release/* or hotfix/* only)

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Refactor / chore
  • Release / hotfix

Test plan

  • uv run pytest tests/unit/agents/test_onnx_download.py tests/unit/agents/test_onnx_service.py -q — 28 passed

  • Did not run make all on this branch

  • make all passes locally

  • Added/updated tests

Checklist

  • Updated CHANGELOG.md (if user-facing)
  • README / docs updated (if needed)

Made with Cursor

…ling

- Introduced a new module `onnx_download.py` to handle racing between Hugging Face and hf-mirror for model downloads, improving download efficiency.
- Added a helper function `_hf_repo_from_sources` to streamline Hugging Face repository ID extraction from model metadata.
- Updated `get_onnx_model_meta` and `list_onnx_catalog_models` to utilize the new helper function for cleaner code and better handling of source metadata.
- Added unit tests for the new download functionality and metadata handling to ensure reliability and correctness.
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.

1 participant