hf-transfer is a utility library designed to significantly speed up file transfers to and from the Hugging Face Hub. It works by optimizing the underlying transfer mechanisms used by the `huggingface_hub` library. The current version is 0.1.9, and it generally follows the release cadence of the broader Hugging Face ecosystem, with updates often tied to improvements in hub interaction.
pip install hf-transferVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to enable `hf_transfer` within your Python script and then use `huggingface_hub`'s `snapshot_download` function. `hf_transfer` will automatically accelerate the download operation once `hf_transfer.enable_transfer()` is called. Remember that `huggingface_hub` must also be installed for this to work.
Use `HF_TRANSFER_ENABLED=1` or `hf_transfer.enable_transfer()` in code. For older versions of `huggingface_hub` that might check the old variable, ensure compatibility or update `huggingface_hub`.
Call `hf_transfer.enable_transfer()` at the very beginning of your script, or set the `HF_TRANSFER_ENABLED=1` environment variable before running your Python script.
Ensure `huggingface_hub` is installed (`pip install huggingface_hub`) alongside `hf-transfer`.
Evaluate performance in your specific use case. If you experience issues, consider checking network configuration, firewall settings, and disk I/O performance.