Created
August 15, 2019 21:29
-
-
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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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