Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adgaudio/e3f8de42df8a6d81dd20083f1e2920a4 to your computer and use it in GitHub Desktop.
Save adgaudio/e3f8de42df8a6d81dd20083f1e2920a4 to your computer and use it in GitHub Desktop.
A quick hack script that uses ipython to download all pretrained pytorch models
# this is a quick ipython script to download all pre-trained pytorch models.
# run like this:
# ipython THIS_SCRIPT.ipy
import torchvision as tv, types, os.path
# get list of urls ... in a brittle way.
x = {k: v for dct in [getattr(y, 'model_urls') for y in (getattr(tv.models, x) for x in dir(tv.models)) if isinstance(y, types.ModuleType)] for k, v in dct.items()}
# download them to ~/.torch/models
for v in x.values():
b=os.path.basename(v)
!wget -O ~/.torch/models/$b $v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment