[FR][hub] load_state_dict_from_url should avoid using tempfile or allow specifying tmp dir #23607
Labels
module: hub
triaged
This issue has been looked at a team member, and triaged and prioritized into an appropriate module
馃殌 Feature
The
torch.hub.load_state_dict_from_url
functionpytorch/torch/hub.py
Line 409 in 456e66d
calls
_download_url_to_file
which creates a temp file and download to that first, does sha check, and them move to the target location.pytorch/torch/hub.py
Line 381 in 456e66d
When the model is huge and
/tmp
is small, users can not actually finish downloading. And there is no way to specify thetmp
location.Alternatives
I see two potential solutions here:
tmp_folder
file_name + random_uuid
, and use that as a temp file. This way we are always downloading to the same disk and will not have such issues.The text was updated successfully, but these errors were encountered: