MCPcopy
hub / github.com/huggingface/transformers / hf_api

Function hf_api

src/transformers/utils/hub.py:76–88  ·  view source on GitHub ↗

Return a shared HfApi instance tagged with transformers's library info. Routing Hub calls (create_repo, create_commit, snapshot_download, ...) through this instance ensures the library_name/library_version are reported consistently to the Hub.

()

Source from the content-addressed store, hash-verified

74
75
76def hf_api() -> HfApi:
77 """Return a shared HfApi instance tagged with transformers's library info.
78
79 Routing Hub calls (create_repo, create_commit, snapshot_download, ...) through this
80 instance ensures the library_name/library_version are reported consistently to the Hub.
81 """
82 global _hf_api
83 if _hf_api is None:
84 _hf_api = HfApi(
85 library_name="transformers",
86 library_version=__version__,
87 )
88 return _hf_api
89
90
91class DownloadKwargs(TypedDict, total=False):

Callers 15

is_base_mistralMethod · 0.90
save_pretrainedMethod · 0.90
save_pretrainedMethod · 0.85
save_pretrainedMethod · 0.85
__post_init__Method · 0.85
save_pretrainedMethod · 0.85
save_pretrainedMethod · 0.85
save_pretrainedMethod · 0.85
from_pretrainedMethod · 0.85
save_pretrainedMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected