8000 [feature request] torch.hub.load_state_dict_from_url to be replaced by a new good general download-a-file function and to also support local paths and google drive links / private github release links · Issue #73466 · pytorch/pytorch · GitHub 8000
[go: up one dir, main page]

Skip to content
[feature request] torch.hub.load_state_dict_from_url to be replaced by a new good general download-a-file function and to also support local paths and google drive links / private github release links #73466
@vadimkantorov

Description

@vadimkantorov

🚀 The feature, motivation and pitch

It's useful to be able to load pretrained weights via a single-stop method without making checks if it's a url or a local path.

Another useful feature would be to support some cloud storage links. Currently I have this automated way to donload from Google Drive. It has been working for a few years, so the API is kind of stable. One way to account for API changes could be a mandatory opt-in flag enable_best_effort_cloud_links_download=True. This will save some boiler plate in research code.

function downloadgdrive() { wget --load-cookies googlecookies.txt "https://docs.google.com/uc?export=download&confirm="$(wget --quiet --save-cookies googlecookies.txt --keep-session-cookies --no-check-certificate "https://docs.google.com/uc?export=download&id=$1" -O- | sed -rn "s/.*confirm=([0-9A-Za-z_]+).*/\1\n/p")"&id=$1" -O ${2:-$1}; }

# https://drive.google.com/file/d/15zENvGjHlM71uKQ3d2FbljWPubtrPtjl/view?usp=sharing
# https://github.com/microsoft/SimMIM#swin-transformer
mkdir -p data/common
downloadgdrive '15zENvGjHlM71uKQ3d2FbljWPubtrPtjl' data/common/simmim_pretrain__swin_base__img192_window6__800ep.pth

Alternatives

No response

Additional context

No response

cc @nairbv @NicolasHug @vmoens @jdsgomes

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: hubtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0