Pass library_name/version to Hub calls via a shared HfApi (#46318)
* Route Hub calls through a shared library-tagged HfApi instance
Introduce a `hf_api()` helper in `utils/hub.py` returning a shared
`HfApi(library_name="transformers", library_version=__version__)` and route
repo-management, metadata and lightweight download calls through it so the
library info is attributed consistently on Hub requests.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Fix mocked offline test to patch HfApi methods
`list_repo_templates` now calls `list_repo_tree`/`snapshot_download` via the
shared `hf_api()` instance, so the offline test must patch those methods on
`HfApi` rather than the (now removed) module-level functions.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* address comment
* fix
* unreleasted change
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>