huggingface / huggingface_hub

The official Python client for the Huggingface Hub.
https://huggingface.co/docs/huggingface_hub
Apache License 2.0
1.83k stars 471 forks source link

Enabling hf-transfer by default #2279

Closed AlpinDale closed 1 month ago

AlpinDale commented 1 month ago

hf_transfer, to my knowledge, has become very stable recently. I use it daily, and I find it a bit cumbersome that we have to manually install the package, then export a very long env variable to finally have access to faster downloads. I believe it's about time it was made the default behaviour for huggingface_hub. Thoughts? I'm sure many others in the community same the share belief as me.

Wauplin commented 1 month ago

Thanks @AlpinDale for raising the question. hf_transfer is indeed quite stable (at least we don't make changes to it very often). For the record, it is enabled by default on all Spaces for example. However, it is not the best solution for everyone for several reasons:

So all things considered, hf_transfer is stable enough for a lot of use cases but we are not aiming at making it the default. The best way to enable it is to set

julien-c commented 1 month ago

@AlpinDale out of curiosity, is your use case in the context of a CLI command, or from Python code?

AlpinDale commented 1 month ago

Sorry, I was away a for bit. Thanks for answering, @julien-c

I use both the CLI and the python API. For now, I can manage by exporting the hf_transfer env variable in my bashrc.